![](/img/trans.png)
[英]How can I transform a List <string> to a Dictionary<string, int>?
[英]if i have a dictionary<string,list<int,int>>how can i access the key of this list in c#?
我想打印列表的所有键,即排序字典的值。
SortedDictionary<string, object> dict2 = new SortedDictionary<string, object>();
SortedList<int, int> innerdict2= new SortedList<int, int>();
foreach(var k in dict2)
{
foreach(var item in k.value)
{
console.writeline(item);
}
}
以下代码将执行此操作:
static void Main()
{
SortedDictionary<string, SortedList<int, int>> dict2 = new SortedDictionary<string, SortedList<int, int>>();
// TODO: Fill in data
foreach (var k in dict2)
{
foreach (var item in k.Value)
{
Console.WriteLine(item.Key);
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.