使Linq区分大小写 [英] making Linq case sensitive
本文介绍了使Linq区分大小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在将vs 2010与linq一起使用到sql和sql server2008.我如何区分大小写
I am using vs 2010 with linq to sql and sql server 2008. how would i made this case sensitive
var Groups = from gp in _db.Groups
where gp.vcr_GroupName == GroupName
select gp;
此处groupname=abc
和groupname=ABC
相同
推荐答案
假设GroupName是字符串,则可以进行简单的字符串比较并忽略大小写:
Assuming GroupName is a string, you can do a simple string comparison and ignore case:
var Groups = from gp in _db.Groups
where gp.vcr_GroupName.Equals(GroupName, StringComparison.OrdinalIgnoreCase)
select gp;
这篇关于使Linq区分大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文