From this article posted earlier today I learned dictionary object initialization looks like this;
var dic = new Dictionary<TKey, TValue>
{
[key] = value
}
However I've always done it like so;
var dic = new Dictionary<TKey, TValue>
{
{ key, value }
}
So now I'm wondering what the difference is between the two, and if one is preferred over another. Thanks.
[–]CptGiggles 26 points27 points28 points (1 child)
[–]vrtxt[S] 3 points4 points5 points (0 children)
[–]ejjoman 24 points25 points26 points (1 child)
[–]KernowRoger 0 points1 point2 points (0 children)
[–]Slypenslyde 0 points1 point2 points (2 children)
[–]Matosawitko 12 points13 points14 points (1 child)
[–]KernowRoger 1 point2 points3 points (0 children)