c# - Create a lambda expression from a List of objects -


i'm trying implement multi-select filter pass generic repository.

the repository filter method takes expression<func<t, bool>> parameter.

generally apply filter filter(i => i.id == myid && i.name.contains(myname)) in case have set of values provided in list , want iterate through list , dynamically create part of lambda expression pass filter method.

so call filter method filter(mygeneratedlambdaexpression && i.name.contains(myname))

where mygeneratedlambdaexpression resolve (i => i.id == myid1 || i.id == myid2 || i.id == myid3) , myid1, myid2 , myid3 values contained in list

how go doing that?

you need dynamiclinq. see this blog.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -