How can i select the value from the List of keyvaluepair based on checking the key value
List> myList = new
Use Dictionary
. Then you can do
List list = dict[5];
As in:
Dictionary> dict = new Dictionary>();
dict[0] = ...;
dict[1] = ...;
dict[5] = ...;
List item5 = dict[5]; // This works if dict contains a key 5.
List item6 = null;
// You might want to check whether the key is actually in the dictionary. Otherwise
// you might get an exception
if (dict.ContainsKey(6))
item6 = dict[6];