csharp-dictionary

初始化,遍历

Dictionary<int, string> dict = new Dictionary<int, string>()
{
{1,"One"},
{2, "Two"},
{3,"Three"}
};

foreach (KeyValuePair<int, string> item in dict)
{
Console.WriteLine("Key: {0}, Value: {1}", item.Key, item.Value);
}

foreach (var it in nominalVals.Values)
{
sData[pos] = *((int*)&it);
pos += 1;
}

更新

如果是结构体的话
不能直接使用 x[‘x’] = xx 的方式更新,好奇怪。