c# - how do i write an extension method on ConcurrentDictionary -
i have concurrentdictionary object defined concurrentdictionary<int, dirtyflag><int, dirtyflag>
dirty flag enum has dirty/clean values.
i trying write extension method dirty objects. objects has dirtyflag set dirty.
i tried using gives me error:
public static concurrentdictionary<int, dirtyflag> getdirtyroutes(this concurrentdictionary<int, dirtyflag> wholedictionary) { return wholedictionary.selectmany(a => a.value == dirtyflag.dirty); }
this error message getting:
the type arguments method 'system.linq.enumerable.selectmany<tsource,tresult> (system.collections.generic.ienumerable<tsource>, system.func<tsource,system.collections.generic.ienumerable<tresult>>)' cannot inferred usage. try specifying type arguments explicitly.
any help?
public static concurrentdictionary<int, dirtyflag> getdirtyroutes(this concurrentdictionary<int, dirtyflag> wholedictionary) { return new concurrentdictionary<int, dirtyflag>( wholedictionary.where(a => a.value == dirtyflag.dirty) ); }
Comments
Post a Comment