Order a List by a arbitrary sort expression?


Problem:

 The type arguments for method 'System.Linq.Queryable.OrderBy<TSource,TKey>(System.Linq.IQueryable<TSource>, System.Linq.Expressions.Expression<System.Func<TSource,TKey>>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.



Solution:

Note: This requires reference to: Dynamic.dll (not System.Dynamic.dll) as well as
using System.Linq.Dynamic;
If you don't reference Dynamic.dll, or don't declare the using directive, you'll get an error on AsQueryable().

Popular posts from this blog

How to Delete WHM Mail Queue through SSH sent from a particular sender

how to change witribe wlan password? how to secure your witribe router

How to Delete all logs in a cpanel server - SSH