【发布时间】:2015-03-04 03:35:57
【问题描述】:
我目前正在开发一个项目并使用一些 lambda 表达式(基础知识)。而且我有这个要求,我需要根据层次结构(父子)显示数据。
当前班级:
public class Phones
{
public int ID { get; set; }
public string Phone { get; set; }
public int ChildOf { get; set; }
}
当前数据
ID Phone ChildOf
1 Samsung 0
2 Apple 0
3 GalaxyS3 1
4 GalaxyS4 1
5 5S 2
6 iPhone 6+ 2
我期待以下结果:
结果
**Samsung**
GalaxyS3
GalaxyS4
**Apple**
5S
iPhone6+
【问题讨论】: