M
moo
Forgive the fairly mundane question, but all the code samples I've
found searching for initializing a dictionary have only shown one way,
specifically:
<code>
HybridDictionary toy = new HybridDictionary();
toy.add(key, value);
</code>
In my application I want to create a dictionary where I already know
the initial values that I want to add to the dictionary and was
wondering if theres an analogous 1-line way (ie <code> int[] myNums
{1,2,3,4,5}; </code> ) of doing this. I come from a Python background
where it's fairly simple to say <code> myDict = { "key" : "value",
"key2": "value2"} </code> so I'm used to a bit of syntactic
sugar...any of this in C#?
Thanks
found searching for initializing a dictionary have only shown one way,
specifically:
<code>
HybridDictionary toy = new HybridDictionary();
toy.add(key, value);
</code>
In my application I want to create a dictionary where I already know
the initial values that I want to add to the dictionary and was
wondering if theres an analogous 1-line way (ie <code> int[] myNums
{1,2,3,4,5}; </code> ) of doing this. I come from a Python background
where it's fairly simple to say <code> myDict = { "key" : "value",
"key2": "value2"} </code> so I'm used to a bit of syntactic
sugar...any of this in C#?
Thanks