Which Version of StringComparer to use(使用哪个版本的 StringComparer)
问题描述
如果我想要一个不区分大小写的字符串键字典,考虑到这些约束,我应该使用哪个版本的 StringComparer:
If I want to have a case-insensitive string-keyed dictionary, which version of StringComparer should I use given these constraints:
- 字典中的键来自 C# 代码或仅以英语语言环境(美国或英国)编写的配置文件
- 该软件已国际化,可在不同的语言环境中运行
我通常使用 StringComparer.InvariantCultureIgnoreCase 但不确定这是否正确.这是示例代码:
I normally use StringComparer.InvariantCultureIgnoreCase but wasn't sure if that is the correct case. Here is example code:
Dictionary< string, object> stuff = new Dictionary< string, object>(StringComparer.InvariantCultureIgnoreCase);
推荐答案
这篇 MSDN 文章涵盖了您可能想深入了解的所有内容,包括土耳其语-I 问题.
This MSDN article covers everything you could possibly want to know in great depth, including the Turkish-I problem.
我已经有一段时间没有阅读它了,所以我要再次阅读它.一小时后见!
It's been a while since I read it, so I'm off to do so again. See you in an hour!
这篇关于使用哪个版本的 StringComparer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用哪个版本的 StringComparer


基础教程推荐
- 全局 ASAX - 获取服务器名称 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01