I have a List<KeyValuePair<string, Records> mylist;
I would like to loop in the list foreach different key value. Something like
foreach(var item in myList.select(/\*query the disctinct values of key here ?*/)
is it possible ? How ?
I have a List<KeyValuePair<string, Records> mylist;
I would like to loop in the list foreach different key value. Something like
foreach(var item in myList.select(/\*query the disctinct values of key here ?*/)
is it possible ? How ?
You can do
foreach(var item in myList.Select(x => x.Key).Distinct())
{
//Your Logic
}
myList.Select(x => x.Key).Distinct() would give you distinct Keys and foreach will loop over them.