Comment

Comment by mrcsharp

> I imagine that's the main driver for creating SelectNotNull

Sure. And now we are fighting the compiler and in the process writing less efficient code.

The compiler gives us a way to deal with this situation. It is all about being absolutely clear with intentions. Yes, Where(..) in my example would return IEnumerable<TR?> but then in subsequent code I can tell the compiler that I know for a fact that TR? is actually TR by using the null forgiving operator (!).

parent mrcsharp 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton