C# Distinct on IEnumerable with custom IEqualityComparer

后端 未结 3 1883
别跟我提以往
别跟我提以往 2020-12-07 18:41

Here\'s what I\'m trying to do. I\'m querying an XML file using LINQ to XML, which gives me an IEnumerable> object, where T is my \"Village\" class, filled

3条回答
  •  死守一世寂寞
    2020-12-07 19:27

    return alliances.Select(v => v.AllianceName).Distinct();

    That would return an IEnumerable instead of IEnumerable.

提交回复
热议问题