Patrick Patrick - 1 year ago 96
C# Question

linq query to return distinct field values from a list of objects

class obj
int typeID; //10 types 0-9
string uniqueString; //this is unique

Assume there is list with 100 elements of obj, but only 10 unique typeIDs.

Is it possible to do write a LINQ query return the 10 unique ints from the list of objs?

Answer Source