我该如何使用LINQ
来实现以下目标?
我有一些 c# 对象(我写它们只是JSON
为了简化)
{ Name: A, Domain: a, SubDomain: 1}
{ Name: B, Domain: a, SubDomain: 2}
{ Name: C, Domain: b, SubDomain: 1}
{ Name: D, Domain: b, SubDomain: 2}
{ Name: E, Domain: c, SubDomain: 1}
我想将它们收集为:
{ Domain: a ,{{Name: A, SubDomain: 1}, {Name: B, SubDomain: 2}}
Domain: b ,{{Name: C, SubDomain: 1}, {Name: D, SubDomain: 2}}
Domain: c ,{{Name: E, SubDomain: 1}}