我试图在ID列上加入两个列表(flist和slist)。列表定义,类定义,列表内容和所需结果显示如下。在指定的列上加入两个列表
List<first> flist= new List<first>();
List<second> slist= new List<second>();
public class first
{
public string name { get; set; }
public int ID{ get; set; }
public string itemAttr { get; set; }
}
public class second
{
public int ID{ get; set; }
public string itemAttr{ get; set; }
}
列出内容
flist:
apples | 1
bananas| 2
trees | 3
slist:
1 | fruit
3 | not-fruit
期望的结果:
flist:
apples | 1 | fruit
bananas | 2 |
trees | 3 | not-fruit
看看linq的'join',[这里是参考资料](http://msdn.microsoft.com/en-us/library/vstudio/bb397895.aspx) – Candide 2013-02-21 16:18:27
感谢您指点我正确的方向,Candide! – 2013-02-21 16:19:33