LINQ

LINQ OrderBy – using Comparer<T>.Create and F#’s Object Expressions

.Net 4.5 introduced a handy little new method Comparer<T>.Create to aid the creation of bespoke comparers, which is great because it means that you don’t have to define a new Comparer class when it is going to be needed once. In case you’re wondering, it’s still not possible to define anonymous implementation of interfaces in …

LINQ OrderBy – using Comparer<T>.Create and F#’s Object Expressions Read More »

Eric Lippert on the decision to omit Enumerable.ForEach

Found another interesting post on Eric Lippert’s blog, this one explain the rationales behind why there’s no built-in Enumerable.ForEach extension method, one which myself and no doubt many others had decided to implement ourselves. As he explains, there are two main philosophical reasons why he’s against such an extension method: "The first reason is that …

Eric Lippert on the decision to omit Enumerable.ForEach Read More »

Functional programming with Linq – Enumerable.SequenceEqual

Yet another useful method on the Enumerable class, the SequenceEqual method does exactly what it says on the tin and tells you whether or not two sequences are of equal length and their corresponding elements are equal according to either the default or supplied equality comparer: As you know, for reference types the default equality …

Functional programming with Linq – Enumerable.SequenceEqual Read More »

Enumerable.Append and Enumerable.Prepend extension methods

Another gem I found on StackOverflow today (I’ve been spending a lot of time there these last couple of days..), this time in the form of a question on how to append or prepend a single value to an IEnumerable<T>. Greg provided an elegant solution to this particular problem, and here’s his answer: Which you …

Enumerable.Append and Enumerable.Prepend extension methods Read More »

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close