Func<T> vs. Expression<Func<T>> in LINQ

Linq is fantastic in that it provides a consistent syntax to query all sorts of data from in-memory collections, SQL databases, XML files, even external APIs. One of it’s strengths is that you can write a Linq provider for any data source the you want to support. Most people know about the “not obvious until it’s obvious” difference between IEnumerable<T> and IQueryable<T> - one represents an in-memory collection and one represents a query which will be executed at some point against a data source. [Read More]
csharp  linq 

Sorting IQueryables using strings and reflection

Wouldn’t it be great to be able to specify the property to order on at runtime for a LINQ query? I.e. items = items.OrderBy("SomeProperty"); rather than items = items.OrderBy(s => s.SomeProperty); How to dynamically sort an IQueryable Later on in this post we’ll go into depth on how to implement an extension method from first principles to do just that but if you just want to quickly use a string to sort an IQueryable right away- go ahead and install Dynamic LINQ. [Read More]
linq  guide  csharp