方法一

1
2
3
4
5
6
Dictionary<TKey, TValue> dict = new Dictionary<TKey, TValue>
{
{TKey, TValue},
{TKey, TValue},
{TKey, TValue}
}

方法二

1
2
3
4
5
6
Dictionary<TKey, TValue> dict = new Dictionary<TKey, TValue>
{
[TKey] = TValue,
[TKey] = TValue,
[TKey] = TValue
}