c# - 格式化字典的键值

标签 c# dictionary

我想改变字典键值的格式。

有点像

Dictionary<string,string> dictcatalogue = new Dictionary<string,string>();

dictCatalogue = dictCatalogue.Select(t => t.Key.ToString().ToLower() + "-ns").ToDictionary();

如何在不影响值的情况下更改字典的键

最佳答案

您创建新词典的方向是正确的:

dictcatalogue = dictcatalogue.ToDictionary
       (t => t.Key.ToString().ToLower() + "-ns", t => t.Value);

关于c# - 格式化字典的键值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16299010/

相关文章:

Python 字典与 C++ 标准 :unordered_map (cython) vs cythonized python dict

C# 字典 : making the Key case-insensitive through declarations

c# - displayformatattribute 自定义格式化字符串

c# - C#.net循环线程堆栈溢出

c# - 带有第一个大写字符+数字的正则表达式

c# - 在 Windows Phone 7 中通过 http 流式传输使用 .pls 文件播放广播

c# - 您会推荐 Iron Ruby、Iron Python 或 PowerShell 来使 C# 应用程序成为脚本宿主吗?

python - 附加到 python 字典

python - 如何以嵌套字典格式对值进行排序?

python - 字母计数词典