//从老集合中查询每一个元素d存入新集合 var list = from d in list_dog select d; //编译后会生成对应的标准查询运算符 linq是一种类似于sql 标准的语法糖 list = from d in list_dog where d.Gender==false select d; //排序 list = from d in list_dog orderby d.ID ascending orderby d.Age descending select d; //连接查询 var listjoin = from d in list_dog join dt in list_dogtoy on d.ID equals dt.ID_Dog select new { Name = d.Name, ToyName = dt.Name }; //group by var list_groupby = from d in list_dog group d by d.Gender;
时间: 2024-10-12 23:57:44