【通过C#查询时SQL Server 2005区分大小写】教程文章相关的互联网学习教程文章

首页> C#> JsonConvert DeserializeObject区分大小写【代码】

这个问题已经在这里有了答案: > Json.NET case-sensitive deserialization 1个我正在尝试将字符串内容反序列化为对象,但是我希望内容区分大小写.该代码仅在字符串具有小写字母属性时才成功,而在具有大写字母属性时失败.以下是课程:internal class ResponseList {[DataMember][JsonProperty]internal List<Response> Value { get; set; } }internal class Response {[D...

c# – 从列表不区分大小写中获取重复项【代码】

List<string> testList = new List<string>(); testList.Add("A"); testList.Add("A"); testList.Add("C"); testList.Add("d"); testList.Add("D");此查询区分大小写:// Result: "A" List<String> duplicates = testList.GroupBy(x => x).Where(g => g.Count() > 1).Select(g => g.Key).ToList();它如何看起来不区分大小写? (结果:“A”,“d”)解决方法:通过使用GroupBy的重载实现,您可以在其中提供所需的比较器,例如: StringC...

c# – 如何在ef core 2中包含不区分大小写的内容?【代码】

我试图通过searchstring过滤列表. It says in the doc on the blue note: > IQueryable为您提供Contains的数据库提供程序实现.> IEnumarable为您提供Contains的.NET Framework实现> SQL-server实例的默认设置不区分大小写.>应避免使用“ToUpper”进行明确的不区分大小写的调用,因为它会降低性能. 我的过滤如下:IQueryable<ApplicationUser> customers = from u in _context.Userswhere (u.Customer != null && u.IsActive)select...

c# – 忽略ASP.NET RegularExpressionValidator中的区分大小写【代码】

我有一个RegularExpressionValidator,唯一有效的输入是8个字符长,由字母MP后跟6位数字组成.目前我有以下正则表达式,它确实有效^(MP|mp|Mp|mP)[0-9]{6}$但感觉有点黑客.我希望能够指定MP可以是大小写的任意组合,而不必列出可用的组合. 谢谢, 大卫解决方法:您可以在定义Regex对象时执行此操作Regex exp = new Regex(@"^mp[0-9]{6}$",RegexOptions.IgnoreCase);或者你可以使用^(?i)mp [0-9] {6} $语法,这将使正则表达式的特定位不区分...

c# – 在不区分大小写的字典键中忽略连字符【代码】

我在asp.net/vb.net中有一个不区分大小写的字典,如下所示:Dim caseInsensitiveDictionary = New Dictionary(Of String, Single)(StringComparer.OrdinalIgnoreCase)它拥有这样的价值观one hundred, 100 one hundred one, 101 one hundred two, 102我希望如果用户试图找到这样的值:Response.Write(dictionary("ONE-hundred").ToString)他得到100,但现在它变得异常,因为字典键没有hyphon’ – ‘.我需要覆盖哪种方法. 请建议解决方...

c#文件路径字符串比较不区分大小写【代码】

我想在c#中比较包含文件路径的两个字符串. 但是,因为在ntfs中默认使用不区分大小写的路径,所以我希望字符串比较以相同的方式不区分大小写. 但是,我似乎无法找到有关ntfs如何实际实现其不区分大小写的任何信息.我想知道的是如何使用ntfs用于文件路径的相同大小写规则对字符串进行不区分大小写的比较.解决方法:从MSDN开始:The string behavior of the file system, registry keys and values, and environment variables is best re...

c# – 如何在linq中比较两个不区分大小写的复杂对象【代码】

我必须列出对象.所以我需要比较这些对象,并从“datActualItem”到列表获得满意的列表.列表“datActualItem”项可能区分大小写,但列表“datFiltItem”项目都是小写字母,我的代码如下.var datActualItem = (List<UserRoleListViewModel>)TempResult.ToList();var datFiltItem = ((List<UserRoleListViewModel>)usersDataSource.Data).ToList();var objnewm = new List<UserRoleListViewModel>();foreach (var item in datActualItem)...

c# – 在不区分大小写的HashSet中获取值【代码】

我有不区分大小写的HashSet< string>:private HashSet<string> a = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);我很好奇,如果我现在可以在实际情况下提取字符串.我需要的伪代码:return a.Contains(word) ? a[word] : null;(只是一个伪代码,它不会工作) 例如,我在HashSet中有字符串“TestXxX”.我需要将“testxxx”(或“tEsTXXx”)作为输入并返回“TestXxX”的代码. 我目前的解决方法是使用Dictionary< str...

不使用C#中的正则表达式进行不区分大小写的替换?【代码】

有没有办法在不使用C#中的正则表达式的情况下对字符串进行不区分大小写的替换? 这样的事情string x = "Hello";x = x.Replace("hello", "hello world");解决方法:你可以尝试类似的东西string str = "Hello"; string replace = "hello"; string replaceWith = "hello world"; int i = str.IndexOf(replace, StringComparison.OrdinalIgnoreCase); int len = replace.Length; str = str.Replace(str.Substring(i, len), replaceWith)...

c# – 使用phpMyAdmin更改MySql区分大小写?

我正在运行Blogengine.Net,并注意到这些表都是小写的(表名为be_settings),但很多查询都是用mixcase编写的(Select *来自be_Settings).如果您的MySql实例在Windows上运行或设置为Windows的可容性,则此方法可以正常工作.我收到错误,因为我的托管服务提供商MySql实例区分大小写.我可以更改设置以通过phpMyAdmin修复此错误吗?如果我不需要,我不想完成所有代码并修复BlogEngine.Net.解决方法:MySQL表名中的区分大小写特定于OS. MySQL数据...