I have a dictionary declared like this.
public static Dictionary<int?, List<int?>> pegMap = new Dictionary<int?, List<int?>>();
Now I’m trying to check a whether the list inside the dictionary contains some value where dictionary key is some value.
if (pegMap.Select(y => y.Value.Contains(disc)).Where(x => x.Equals(key)))
{
peg = (int)key;
}
But the compiler is angry and throwing me an error like so –
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<bool>' to 'bool'
What am I doing wrong here. Please help.
It sounds like you’re completely ignoring the fact that you’re using a dictionary. It sounds like you might want: