c# - Lambda Statement -
c# - Lambda Statement -
i wondering if there improve way of accomplishing this;
i have object - 1 of property dictionary. have set of comma separated values. need filter dictionary , elements dictionary value matches @ to the lowest degree 1 of values
this have tried there shorter way of doing this?
just explain: filtervalue list of values(e.g. "4,5')
list<string> vals = new list<string>(); vals.addrange(filtervalue.split(new char[]{','})); list<t> bindingentities = entities.where( e => { foreach(keyvaluepair<string, object> kvp in e.extraproperties) { if(vals.contains(kvp.value.tostring())) homecoming true; } homecoming false; }).tolist();
you can utilize any function:
list<string> vals = new list<string>(); vals.addrange(filtervalue.split(new char[] { ',' })); var bindingentities = entities.where( e => e.extraproperties.any( kvp => vals.contains(kvp.value.tostring()))).tolist(); c# lambda
Comments
Post a Comment