0
点赞
收藏
分享

微信扫一扫

c# .net 根据参数名称的ASCII码表的顺序排序,使用SortedDictionary字典

路西法阁下 2022-06-17 阅读 26

SortedDictionary没有按照插入顺序排列 而是一种string 排序 ,根据key值进行

计算规则:数字>小写字母>大写字母

SortedDictionary<string, object> m_values = new SortedDictionary<string, object>();
m_values.Add("b",1);
m_values.Add("d", 2);
m_values.Add("a", 3);
m_values.Add("c", 4);
foreach (var item in m_values)
{
Console.WriteLine($"{item.Key}={item.Value}");
}
a=3
b=1
c=4
d=2


举报

相关推荐

0 条评论