您将按以下方式使用。
我正在收回正确的价值。请执行相同的操作。
using System;
using System.Collections.Generic;
namespace ConsoleApplication3
{
public class Program
{
public static void Main()
{
var dictionary = new Dictionary<int, Dictionary<string, string>>();
var value = new Dictionary<string, string> { { "Key1", "Value1" }, { "Key2", "Value2" } };
dictionary.Add(1, value);
Dictionary<string, string> result;
if (dictionary.TryGetValue(1, out result))
{
foreach (var key in result.Keys)
{
Console.WriteLine("Key: {0} Value: b{1}", key, result[key]);
}
}
}
}
}
_“不起作用”_是一个非常糟糕的替代品,无法将Dictionary <>转换为字符串。始终包含完整的错误消息。 – 2014-09-20 10:42:22