string[] names = { "Burke", "Connor", "Frank",
"Albert", "George", "Harris", "David" };
peoples[] people = {
new peoples("Connor",20),
new peoples("John",22),
new peoples("Merry",33),
new peoples("Frank",65),
new peoples("Frank",34),
new peoples("George",19)
};
var query = from n in names
join p in people on n equals p.Name into matching
select new { Name = n, Count = matching.Count() };
请告诉我这个查询的点符号。 感谢。
答案 0 :(得分:2)
连接的点符号取决于它后面的内容以及您是否有“into”子句(对于组连接)。在这种情况下,它将是:
var query = names.GroupJoin(people, n => n, p => p.Name,
(n, matching) => new { Name = n, Count = matching.Count() });
Join
代替GroupJoin