Replies: 1 comment
-
|
Should default(T1) be annotated with exclamation? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How should be rewritten next code to not have CS8620 (it appeared after #44339 was fixed):
#nullable enable public IEnumerable<T1> GetItems<T1>(IEnumerable<T1> input) { return input.Select( item => new { Item = item, Final = false }).Concat( Enumerable.Repeat( new { Item = default(T1), Final = true }, 1)) .Where(it => !it.Final).Select(it => it.Item); } #nullable restoreSample can be checked here. How it can be defined that Item can have
nullin original Select?Beta Was this translation helpful? Give feedback.
All reactions