I have used Dynamic Linq
in my application and unfortunately it's not working.
Here is my sample code.
List<string> contains = new List<string>() { "Poland", "Ecuador" };
List<object> array = new List<object>();
array.Add("Austria");
array.Add("Eritrea");
array.Add(contains);
//this works
var data0 = Contact.GetContactsList().AsQueryable().Where("@0.Contains(outerIt.Country)", array);
//this does not work
var data = Contact.GetContactsList().AsQueryable().Where("Country.Equals(@0) OR it.Country.Equals(@1) OR @3.Contains(outerIt.Country)", array.ToArray());
I have list of contacts related with countries.
You can see that I have used mixed operators i.e equals and contains.
If contains is used separately then it works which is correct.
I tried to do new thing here, using both Equals and Contains operators is same query string.
I have attached am image describing output or data0
and error while processing to get data
Thank You.
I made a silly mistake there. The code is working fine but I gave wrong index there. Index 3 should be replaced with 2. :P enter image description here
The result is attached.