【发布时间】:2011-09-08 01:37:08
【问题描述】:
我正在尝试将具有父 + 子数组的简单类扁平化为单个类。
发件人:
public class Foo
{
public int Id { get; set; }
public string Name { get; set; }
public ICollection<PewPew> PewPews { get; set; }
}
public class PewPew
{
public string Name { get; set; }
public string Whatever { get; set; }
}
- 1 | Fred | { { AAA | xxx }, { BBB | yyy } }
- 2 | Bill | { { CCC | zzz } }
收件人:
public class FooProjection
{
public int Id { get; set; }
public string Name { get; set; }
public PewPewName { get; set; }
public PewPewWhatever { get; set; }
}
- 1 | Fred | AAA | xxx
- 1 | Fred | BBB | yyy
- 2 | Bill | CCC | zzz
【问题讨论】:
标签: c# .net linq linq-to-objects