I need to do a select distinct where I compare 2 values. In the method I do the following:
DistinctErrors = Errors.Select(o => new { o.Type, o.References })
.Distinct()
.Count();
o.Type is a string, but o.References is a Collection of objects. Each object in o.References has a Name property as string and a Value Property as string, and it's actually o.Type and each o.Reference's Name and Value values I want to compare, so it's actually 3 values to compare.
How can I compare Type with each Reference Name and Value?
Thanks, Peter
Errorsthat have a distinctTypeand a distinct collection ofReferences? Or do you want the number of distinct references inErrorsbyType,Name, andValue? An example would help here.EqualsandGetHashCodemethods in the type you are working. Distinct will see the content of these methods to execute.