Configuring LINQ Dynamic Query Library

I had a problem setting up this dynamic Linq library, so I can use the Dynamic where clauses. Can someone advise me how to add this library to my project and the correct link.

http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx

also visible in the message

Is there a Linq template for dynamically creating a filter?

thanks,

Update -

var x = ListofObjects.AsQueryable().Where("Some comparison"); 

Update -

After adding the Dynamic.cs library, my project will not build with a bunch of compilation errors coming from this particular class. everything looks like.

 The namespace 'System.Linq.Dynamic' already contains a definition for 'DynamicOrdering' 
+4
source share
1 answer

Everything seems to work fine:

 public class SomeType { public string var1; public string var2; } class Program { static void Main(string[] args) { var myList = new List<SomeType>(); myList.Add(new SomeType() { var1 = "abc", var2 = "abc" }); myList.Add(new SomeType() { var1 = "def", var2 = "def" }); foreach (var item in myList.AsQueryable().Where("var1=\"abc\"")) Console.WriteLine("item.var1 = " + item.var1); } } 
0
source

Source: https://habr.com/ru/post/1389277/


All Articles