This post is written by guest blogger Albin Sunnanbo. He’s a great friend and source of inspiration and also one of the best developers I know. It was Albin that first introduced me to LINQ, EF Migrations and jQuery that I now use daily. Sometimes you use Tuple<T1, T2> in C# to store results of… Continue reading Creating an Empty List<AnonymousType>
Tag: IEnumerable
Null Handling with Extension Methods
Often we cannot be sure if a parameter passed in to a function has a value. To write error safe code all those parameters have to be checked for null and handled. We have the ?? coalesce operator to help, but still it can be quite a lot of code. Through the use of extension… Continue reading Null Handling with Extension Methods
Return IEnumerable with yield return
Ever needed to return an IEnumerable<T> from a method? Did you create a List<T> instance that you populated and returned? There is a better way, with less memory footprint and better performance. The yield return statement is one of the more mysterious, yet very useful constructs in C#. With yield return it is possible to… Continue reading Return IEnumerable