c# - How to select from List of KeyValuePair? -
i have list of keyvaluepair (key string type , value int type). , want return key value pair list matching criteria example : return list key = "a" , value = 10.
how select work on , how write expression required result ?
you can use linq expression so:
ilist<keyvaluepair<string, int>> values = new list<keyvaluepair<string, int>>();
add key values.
ilist<keyvaluepair<string, int>> result = values.where(v => v.key == "a" && v.value == 10).tolist();
Comments
Post a Comment