I have the following code:
IEqualityComparer<WorkItem> comparer =
new LambdaComparer<WorkItem>((item1, item2) => item1.Type == item2.Type);
var someVar = Pad.Distinct(comparer);
(The idea is to get 1 of each type)
And it is giving the following error message:
The type arguments for method 'System.Linq.Enumerable.Distinct (System.Collections.Generic.IEnumerable, System.Collections.Generic.IEqualityComparer)' cannot be inferred from the usage. Try specifying the type arguments explicitly. 490
I have done something similar and it works just fine:
Pad = new Dictionary<WorkItem, Canvas>(new LambdaComparer<WorkItem>((x, y) => x.Id == y.Id, x => x.Id));
So I don't think it is my LamdaComparer class.
Any ideas on how to fix this? (I guess I could just do a ForEach and get the distinct manually.)