LINQ巩固
- LINQ过滤运算符
Where 基于谓词函数过滤值
测试例子如下:
public class TestModel
{
public string Name { get; set; }
public string Age { get; set; }
}
List<TestModel> lst = new List<TestModel>()
{
new TestModel(){Name = "张三" },
new TestModel(){Name = "李四" },
};
var querys1 = from item in lst where item.Name == "李四" select item;
var querys2 = lst.Where(item => item.Name == "李四");
- LINQ Join操作
!运算符 | 描述 | 查询语法 |
---|---|---|
Join | 运算符连接两个序列配键的基础 | join...in...on...equals... |
GroupJoin | 连接连个序列和组匹配元素 | join...in...on...equals...into |
原文地址:https://www.cnblogs.com/zzr-stdio/p/9478615.html
时间: 2024-11-25 10:45:48