linq Group By from DataTable
I have DataTable Like this
Size | Type | FB | FP
2 | typeA | FB1 | A1
3 | typeB | FB1 | A1
4 | typeC | FB2 | A2
5 | typeD | FB2 | A2
6 | typeE | FB2 | A2
I want to have some thing like that
Size | Type | FB | FP
2 | typeA | FB1 | A1
3 | typeB | |
4 | typeC | FB2 | A2
5 | typeD | |
6 | typeE | |
how can i make it? I can make Group By
var result = from row in cableDataTable.AsEnumerable()
group row by new
{
FB = row.Field<string>("FB"),
FP = row.Field<string>("FP"),
Size = row.Field<int>("Size"),
Type = row.Field<int>("Type")
} into g
select new
{
FB = g.Key.FB,
FP = g.Key.FP,
Size = g.Key.Size,
Type = g.Key.Type
};
but it that could't give the result
thank you for your attention
No comments:
Post a Comment