本文介绍了LINQ区分大小写(不TOUPPER或TOLOWER)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public Articles GetByName(string name, Categories category, Companies company)
{
var query = from article in session.Linq<Articles>()
where article.Name == name &&
article.Category == category &&
article.Company == company
select article;
return query.FirstOrDefault();
}
如何查询不区分大小写。我可以使用TOLOWER或TOUPPER,但我想用OrdinalIgnoreCase。这可能吗?
how can query be case insensitive. I can use toLower or toUpper but i want with OrdinalIgnoreCase. Is it possible?
推荐答案使用 String.Equals 配合适当的参数使其不区分大小写
Use String.Equals with the appropriate parameters to make it case insensitive
mySource.Where(s => String.Equals(s, "Foo", StringComparison.CurrentCultureIgnoreCase));更多推荐
LINQ区分大小写(不TOUPPER或TOLOWER)
发布评论