News for hackers. Stuff that matters.
Re:LINQ Ruined My Favorite Interview Question by usea on Thursday July 11, 2013 @11:07AM (#6026464)
I agree with your pain points.

We try to use ICollection in our APIs instead of IEnumerable, since the latter can have surprising semantics like being a wrapper for some operation which may not be valid anymore, or might be slower than you expect to do things like .Count(). IMO it's really not best for transporting across interface boundries in the most common case; only when you're specifically trying to avoid having the whole collection in memory or something like that.

Another thing that can help is this wonderful May<T> library[1]. It a great option type[2] for .NET. It helps make operations more composable.

[1] https://github.com/Strilanc/May

[2] http://en.wikipedia.org/wiki/Option_type

There are no comments on this comment yet.