C# Linq group by 多个字段

  var result = (
                from meta in metaErrorInfos
                group meta by new
                {
                    meta.SchemaInfoId,
                    meta.SchemaName
                } into t
                select new
                {
                    SchemaInfoId = t.Key.SchemaInfoId,
                    SchemaName = t.Key.SchemaName,
                    Tec = t.Max(x => x.Tec)
                }).ToList();

Group By字段为 meta.SchemaInfoId,meta.SchemaName

你可能感兴趣的:(C# Linq group by 多个字段)