score:0

You could run the foreach query by the desired keys only:

foreach ( var item in dataList.Where( i => i.Key == "name" ) )
{
    //use name items
}

This uses LINQ to include only the KeyValuePairs where Key is "name". You will have to add using System.Linq to the top of your source code file for this to work properly.


Related Articles