I have a ConcurrentDictionary object defined as ConcurrentDictionary<int, DirtyFlag><int, DirtyFlag> where dirty flag is an Enum which has Dirty/Clean values.
I am trying to write an extension method to get only Dirty objects. Those objects that has DirtyFlag set to Dirty.
I tried using this but it gives me an error:
public static ConcurrentDictionary<int, DirtyFlag> GetDirtyRoutes(this ConcurrentDictionary<int, DirtyFlag> wholeDictionary)
{
return wholeDictionary.SelectMany(a => a.Value == DirtyFlag.Dirty);
}
This is the error message that i am getting:
The type arguments for method 'System.Linq.Enumerable.SelectMany<TSource,TResult>
(System.Collections.Generic.IEnumerable<TSource>,
System.Func<TSource,System.Collections.Generic.IEnumerable<TResult>>)' cannot
be inferred from the usage. Try specifying the type arguments explicitly.
Any help?
1 Answer