Reputation: 123
I am trying to fetch a list of distinct values from a collection. But I am unable to do so.
For example:
var someValue = (Data.Cast<IDetailType>().Select(x => x.Common.Provider)
.Union(Data.Cast<NDetailType>().Select(x => x.Common.Provider))).Distinct();
This query returns me all sets of Data, along with repetition data also.
Upvotes: 0
Views: 149
Reputation: 17556
You need to tell Distinct , how to compare the objects , please see the overload Distinct(IEqualityComparer<T>)
and see the post how to do it
Upvotes: 1