C# – how do i build dynamic linq queries at runtime using strings

cdynamiclinq

This article talks about building dynamic queries using strings is it possible?

i tried

var ase = a.Select("NEW(activity_date as date)");

and it doesn't work

The type arguments for method
'System.Linq.Enumerable.Select(System.Collections.Generic.IEnumerable,
System.Func)' cannot
be inferred from the usage. Try
specifying the type arguments
explicitly.

C:\.....\filename.xaml.cs

how do i build dynamic linq queries at runtime using strings?

Best Answer

In the linq samples directory there is a cool Dynamic Linq library you can use, Scott Gu has a pretty good blog post on how to use it here.

Related Topic