I'm working with an IEnumerable Dictionary (data.Tags)
inside a List (masterList)
.
Here is a typical query I'm doing (which works):
var tagList =
(from data in masterList
from tag in data.Tags
where tag.id == 0x10
select tag).Distinct(new TagComparer());
The tag
class has fields Id
, Value
and TranslatedValue
. I want to search based on Id
, use Value
to determine which is the minimum and then return the TranslatedValue
(instead of Value
).
All of my attempts thus far throw an ArgumentException, such as this:
var tagList =
(from data in masterList
from tag in data.Tags
where tag.id == 0x10
select new
{
tag.Value,
tag.TranslatedValue
};
return tagList.Min().TranslatedValue;
Is there an elegant solution to this?