次の問題があり、助けを求めたいと思います。個別の値 (1 つのプロパティによる基準) を選択し、残りのプロパティから異なる値を抽出する必要があります。
次のクラスがあり、それぞれにと が異なるBOMが 1 つ以上あるとします。FlatComponentsPartsQtyPer
例:
public sealed class BOM {
public string FlatComponent {
get;
set;
}
public string Part {
get;
set;
}
public string QtyPer {
get;
set;
}
public BOM(String flatComponent, String part, String qtyPer) {
this.FlatComponent=flatComponent;
this.Part=part;
this.QtyPer=qtyPer;
}
}
List<BOM> list=new List<BOM>();
list.Add(new BOM("a", "1", "2"));
list.Add(new BOM("a", "3", "4"));
list.Add(new BOM("b", "5", "6"));
list.Add(new BOM("c", "7", "8"));
list.Add(new BOM("c", "9", "0"));
FlatComponentsLINQ (カンマ区切り) を使用して、各プロパティで個別の値とその異なる値を選択するにはどうすればよいですか?
結果 = [
[「a」、「1、3」、「2、4」]、
["b", "5", "6"],
[「c」、「7、9」、「8、0」]
]
を使用してみ.Distinct()ましたが、LINQ はかなり新しいものです ...