.net - string where in LINQ to objects -


i have linq query that:

elementos = b in elementos b.value.idgrupo = 0 select b 

"elementos" dictionary(of long, myobject). myobject has approximately 50 properties.

the problem have have new requirement accept string parameter "where" condition. "property1>10 , property2 'anystring' or property3<=25". (that means property have condition. have string , numeric properties.)

i'd keep using linq, adding condition comes. i'm aware produce exception if condition misspelled or something, that's acceptable (by try catchs). wouldn't want parse string build parameters or anything. have chance?

thank much!

you can use dynamic linq:

dim filter string = "property1>10 , property2 'anystring' or property3<=25" dim results = elementos.where(filter) 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -