【发布时间】:2013-04-24 13:12:37
【问题描述】:
是否可以使用 { } 将值加载到字典中?
失败了
static Dictionary<byte, byte> dict = new Dictionary<byte, byte>() { new KeyValuePair<byte, byte>(1, 1) };
这不会失败,所以我怀疑 { }
中有加载语法static Dictionary<byte, byte> dic1252expand = new Dictionary<byte, byte>() { };
这是有效的示例语法
byte[] bytes = new byte[] { 1, 2, 3 };
KeyValuePair<byte, byte> kvp = new KeyValuePair<byte, byte>(1, 1);
【问题讨论】:
标签: c# .net dictionary