Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For that I use my own extension function like `?.Map(x => ...)`, defined as `Map(this T input, Func<T, TResult> map) => map(input)`. Still a bit ugly, but much nicer than the ternary operator.

Of course that doesn't fix all the other issues with null handling in C# (inconsistency between null references and null value types, inability to nest options, ...)



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: