我想创建一个字典排序字典,排序字典的字典按降序排列。我正在尝试:
private readonly IDictionary<string, SortedDictionary<long, string>> myDict= new Dictionary<string, SortedDictionary<long, string>>();
如何将比较器设置为:
Comparer<long>.Create((x, y) => y.CompareTo(x))
对于嵌套字典?
答案 0 :(得分:6)
使用以下代码:
"build.parent": "regular parent build stuff"
"build.child": "build the child library"
"publish.parent": "stuff to publish the parent to npm"
"publish.lib": "ng-packagr stuff to publish the library to npm"
您正在初始化一个空字典,其中不包含任何嵌套字典。要执行后者:
var myDict = new Dictionary<string, SortedDictionary<long, string>>();