Thursday, May 5, 2011

Declare and Intiaize Dictionary in a single line

This is a way to initialize the Dictionary using Collection intializers , specify one or more element intializers when you initialize a collection class that implements IEnumerable

Dictionary dic = new Dictionary()
{
{"erer","er"},
{ "rrr","rr"}
};

No comments:

Post a Comment