在这里,我需要获取名称 Murugan 我的输出应该是 "2" 的总数。如何为此编写 Linq 查询
林克:
Person[] names = {new Person { Name = "Murugan", Money = 15000 },
new Person{Name="Vel",Money=17000},
new Person{Name="Murugan",Money=1000},
new Person{Name="Subramani",Money=18000},
new Person{Name="Vel",Money=2500}};
var result = from val in names
where val.Name == "Murugan"
select val;
Console.WriteLine(result);
Console.ReadLine();