LINQ GroupBy 查询数据赋给select
roles.GroupBy(a => new { a.SubjectID,a.SubjectName}).Select(p => new SelectListItem() { Value = p.Key.SubjectID.ToString(), Text = p.Key.SubjectName }).ToList();
roles.GroupBy(a => new { a.SubjectID,a.SubjectName}).Select(p => new SelectListItem() { Value = p.Key.SubjectID.ToString(), Text = p.Key.SubjectName }).ToList();