Do you prefer int or Int32? How about string or String? Some developers have strong preferences, others don’t care. Personally, I prefer to use the actual CLR type names (in other words I prefer Int32 and String) and since I do, I feel as though I am a second-class citizen.
Interestingly enough, it is Visual Studio who makes me feel this way! I am constantly frustrated when I use intellisense to auto-populate an object instantiation like this:
Dictionary<String,Int32> dictionary = new
If I use intellisense to populate the remaining code I am left with this:
Dictionary<String,Int32> dictionary = new Dictionary<string,int>();
This happens with any code that Visual Studio generates on my behalf: method overrides, method stubs, etc. It would be really nice to be able to specify that I prefer to use the CLR type names over their C# aliases. So I am making an official Visual Studio feature request:
Please allow us to specify whether or not suggested and generated code uses C# aliases or CLR type names.
Those of us who care will greatly appreciate it.
5 Comments
I’ll sign your petition.
Maybe a petition isn’t such a bad idea :)
AFAIK the recommendation is to use the language’s ‘native’ alias, i.e. int in C#, Integer in VB.NET.
Why not just var dictionary = new Dictionary<String,Object> … then you don’t hit the problem :-)
Does your blog have some type of code tag? It’s really annoying losing the less than / greater than symbols!
@Michael Chandler – I am working setting up a better textbox for comments – currently all angle brackets are stripped out. Sorry about that! As for using var, that is not a bad idea – at least I can avoid the pain when I use local variables! :)
Post a Comment