linq使两个集合相连接转换为新的集合
static void Main(string[] args)
{
List<Man> list = new List<Man>();
for (int i = 0; i < 10; i++)
{
Man d = new Man();
d.Age = i ;
d.Name = i.ToString();
list.Add(d);
}
List<Test> name = new List<Test>();
for (int i = 5; i < 10; i++)
{
Test d = new Test();
d.Name = i.ToString();
name.Add(d);
}
List< Test> tsss = (from li in list
join nm in name
on li.Name equals nm.Name
where li.Age > 5
select new Test
{
Name = li.Name,
NameAge = nm.Name + li.Age.ToString()
}).ToList();
Console.WriteLine();
}