首页 > 代码库 > Linq学习日记-模糊查询

Linq学习日记-模糊查询


n.Name.StartsWith(Name)--相当于A%
n.Name.EndsWith(Name)  --相当于%A
n.Name.IndexOf(Name)!=-1 --相当于%A%
var listWhere = list.Where(n=>n.Name.StartsWith(Name)||n.Name.EndsWith(Name)||n.Name.IndexOf(Name)!=-1);

var listWhere = list.Where(n=>n.Name.Contains(Name));

Linq学习日记-模糊查询