This is one of the most common question you got when you show LINQ to Entities or LINQ to Nhibernate to people that are not used to LINQ: How can I order by a property if I have the name of the property expressed as String? I’ve blogged in the past how you can do [...]

Continue reading about Order by a property expressed as string in a LINQ Query

In this post I dealt with a  simple extension function to flatten a tree and in one of the comment Robert shared an interesting link that deal with the creation of a wrapper structure to use LINQ style function on tree structure. That article is really interesting, but the adopted solution requires to create a [...]

Continue reading about Generic wrapper for LINQ to Tree

Quite often I deal with tree structures where each node can contains a set of children nodes. When is time to cycle through all the nodes, to execute some logic, you need to write a standard recursive function, an operation that is quite boring and repetitive. The question is, is it possible to write a [...]

Continue reading about Create a tree flatten function to support LINQ queries

Linq distinct with lambda
on January 18th, 2011
On category: LINQ

Linq Distinct function accepts an IEqualityComparer<T> used to compare values of the IEnumerable to remove “equal” objects to implement the Distinct() function. Sometimes it is more useful to specify a simple Func<T, T, Boolean>, a simple predicate that will implement the concept of Equality between elements. To support such a scenario you can write this [...]

Continue reading about Linq distinct with lambda

Linq provider via IEnumerable
on November 20th, 2009
On category: LINQ

If you ever tried to implement a linq provider, you know that this is not a simple task. This is true for a full linq provider, but sometimes we need only a basic support, and in these situations there is probably a simpler approach. Suppose you need to give LINQ support to find user in [...]

Continue reading about Linq provider via IEnumerable