In C# 2.0 we can initialize arrays and lists with values like this:
int[] a = { 0, 1, 2, 3 }; int[,] b = { { 0, 1 }, { 1, 2 }, { 2, 3 } }; List<int> c = new List<int>(new int[] { 0, 1, 2, 3 }); I would like to do the same with Dictionary. I know you can do it easily in C# 3.0 onwards like this:
Dictionary<int, int> d = new Dictionary<int, int> { { 0, 1 }, { 1, 2 }, { 2, 3 } }; But it doesn't work in C# 2.0. Is there any workaround for this without using Add or basing on an already existing collection?