What I want to see next...

time to read 1 min | 171 words

Brad Abrams talks about a new method in the CLR [ ReadAllLines()  ], and the comments list several useful stuff and some wishes.

My wish for the new year is to be able to declaratively set a dictionary. What do I mean by that?

int[] values = { 1, 2, 3, 4, 5, 6 };

But just try to do that for dictionaries:

Dictionary<string, int> values = CreateDictionary();

 

private static Dictionary<string, int> CreateDictionary()

{

    Dictionary<string, int> values = new Dictionary<string, int>();

    values.Add("one", 1);

    values.Add("two", 2);

    return values;

}

 

And this is the best thing that I could come up with! Other languages has initializers for dictionaries. This is something that I use constantly (very easy to setup a relationship between behaviors, for instance), and it's annoying me every time.