Filter an IQueryable with case insensitive.
This question already has an answer here:
myList = myList.Where(m => m.Name.ToLowerInvariant().Contains("John".ToLowerInvariant()));
You can convert all into lower case filter like
IQueryable<MyModel> myList = GetListMyModel().AsQueryable();
myList = myList.Where(m => m.Name.ToLower().Contains("John".ToLower());
Or use
IQueryable<MyModel> myList = GetListMyModel().AsQueryable();
myList = myList.Where(m => m.Name.IndexOf("John",StringComparison.OrdinalIgnoreCase) != -1);
链接地址: http://www.djcxy.com/p/13096.html
上一篇: 有没有函数比较一个字符串与较大的字符串?
下一篇: 过滤大小写不敏感的IQueryable。