Try this:
var listKey = fields.Keys.ToList();
var d1Keys = listKey.Except(list);
foreach (var item in d1Keys)
{
Console.WriteLine($"Key: {item}, Value: {fields[item]}");
}
Looking at the LINQ provided by Member 15415060 above, a neater solution would be something more like:
var fields = new Dictionary<string, string>
{
{"2", "34"},
{"3", "45"},
{"4", "56"}
};
string[] listArray = { "2", "5", "6" };
var listKeys = fields.Keys.ToList().Except(listArray);
var values = listKeys.Select(k => fields[k]);
foreach (var item in values)
{
Console.WriteLine($"item: {item}");
}