A little background. In college I was a Java developer. I became a VB6 developer four years ago and about two years ago I became a VB.net developer. About three weeks ago I changed jobs and became a C# developer. While it is a very similar world (almost the same) there are a few differences that are slightly annoying and a few things I like. There are more differences, but these are the ones that are most striking to me with simple every day development.
Dislikes
Semi-Colons
When I got into VB I thought I was done with semicolons. They are point less. To a computer the difference between a semicolon and newline is a few bits. I am already going to do a new line, why do I need to do a semicolon too. I don’t get it.
Capitalization
C# is a lot more picky with capitalization. A lot more. It knows what is right, but it waits until you screw up and have to go back over it and press Ctrl+Space before it fixes it. VB would correct it for you.I miss that.
Curly Bracket White Space
I hate the ‘{’ lines. Everytime you do a ‘{’ in C#, you devote an entire line to it. The default in C# (and as a result most companies) means an if statement is
if (stuff)
{
//then do stuff
}
else
{
//do other stuff
}
In java, I always did it like this:
if (stuff){
//then do stuff
} else {
//do other stuff
}
and in VB, I did it like this
If stuff Then
//do stuff
Else
//do other stuff
End If
That’s half the lines in the second version than in the first version. I know it is a little picky, but I like having as much information in the screen as possible. Extra whitespace is for webpage design.
Events and delegates
I hate the fact that it’s so complicated to raise an event. You have to create a delegate, declare an event and then when you want raise the event, you have to check to see if it is null first. VB, create an event and raise it when you want to.
Includes
It is probably about the same as VB, but it seems like C# wants to pout more if you don’t do your using before you use the classes first.
What’s Good
Initialization
Declaring a variable in C# is a lot better. While Dim reminds me of Assembly, it’s stupid. Why do I have write Dim message as String instead of message as String or String message
Mulitline Comments
/* is way better than ’ at the beginning of every line.
Boolean Conditions
&& is why better then AndAlso. Also I don’t like having to start my condition with Not when I am using Is.
Like I said, there are more differences, but these are the ones that are most striking to me with simple every day development.