var resultt = from c in ent.Student where c.Name.Contains("王") select new { c.Name, c.Sex, c.StudentId };
var data = ent.Student.Select(p => new { p.Name, p.E_mail, p.ClassId }).Where(p => p.Name.Contains("王"));
怎么用这样:
List<Student>resultt =( from c in ent.Student where c.Name.Contains("王") select new { c.Name, c.Sex, c.StudentId }).ToList();
List<Student>data = ent.Student.Select(p => new { p.Name, p.E_mail, p.ClassId }).Where(p => p.Name.Contains("王")).ToList();
但是用了匿名类报错