您是如何执行linq查询来对我的结果进行排序的?

时间:2018-06-26 20:14:24

标签: c# entity-framework linq

我想做的是在linq查询中使用group by,但是我真的不知道正确的语法是什么,因此语法正确:

当前代码:

public List<Section> getSectionsClass()
{
    var context = GetDbContext();
    return (from cs in context.contenido_seccion
            join c in context.clase on cs.materiaId equals c.materiaId
            group cs by cs.id into gr
            select new Section()
            {
                Name = cs.nombre,
                Id = cs.id,
                IdClass = c.id
            }
    ).ToList();
}

gr中的select之后出现错误,错误内容如下:

Ambiguos invocation

0 个答案:

没有答案