amateur
amateur

Reputation: 44605

distinct items in IEnumerable object

I am working with C# and have an IEnumerable object. Note(IEnumerable and not IEnumerable<T>)

How can I find the distinct items in that object?

Upvotes: 0

Views: 975

Answers (1)

p.s.w.g
p.s.w.g

Reputation: 149020

Use Cast, then Distinct

var distinctItems = items.Cast<object>().Distinct();

Upvotes: 4

Related Questions