Is there a way to use the C# 3.5 collection and object initializers to set
up a Dictionary<>? Such as:

        private static Dictionary<int, string> m_codestrings =
            new Dictionary<int, string>()
        {
            new KeyValuePair<int, string>()
            {
                Key = 1,
                Value = "A",
            },
        };

This fails because Add() needs two parameters. Which is very reasonable,
but I just wondered whether I'm missing something.

Thanks
David.

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to