Let's say I have this Dictionary:
var Dict = Dictionary<Obj, Value>
And I want to create a new one that is:
var Dict2 = Dictionary<Obj.ParentId, Value>
However, there might be objects that have the same ParentId
, so that would be a problem when creating a new Dictionary. Any two entries with the same ParentId
will have the same Value, so I only care to keep one of the entries. Is there a way to easily do this either through LINQ?
ParentId
andValue
? You can useDistinct
or you might needDistinctBy
. – NetMage