So as expected, Alfred responded to my first post on why I think c# is better. As always, I will point out I openly respect people’s opinion for programming languages and that each language has excellent uses for different things.
So with the disclaimer out of the way so I won’t have an angry mob attacking me, on to why I love c# so much.
Alfred brought up the need for the semi colon to terminate a line. I think this the best idea ever. We do it in our written, why is it such a big deal? More so, I can do this:
updated after Erik yelled at me to provide a more legit example:
isUserPrepped = (angle < safeAngle && angle > -safeAngle)
&& (gyro < safeGyro && gyro > -safeGyro)
&& userIsOnBoard;
while VB has to do this:
isUserPrepped = (angle < safeAngle AndAlso angle > -safeAngle) _
AndAlso (gyro < safeGyro AndAlso gyro > -safeGyro) _
AndAlso userIsOnBoard
I can have 1 line of code expand out multiple physical lines. VB I have to use a _ to say it is an extra line! That is an extra thing I have to worry about when coding with meaningful variable names (sorry, X, Y, and Z only count if I’m doing something in 3D).
As Jeff pointed out in a comment also, C style languages allow me to do this
functionFoo(); functionBar(value); stringBuilder.Append("Clint Rutkas is awesome");
while in VB it would be this:
functionFoo()
functionBar(value)
stringBuilder.Append("Clint Rutkas is awesome")
This is a poor example due to the functions, but there are multiple times where you’ll want everything on one line.
Another great feature of c# is how close it is to other languages. If you run across something in Java, C, C++, Perl, PHP or JavaScript, there is an excellent chance you can reverse engineer what they did with very little effort. With VB, unless it is c# where you’ll be able to use a transcoder, you have to manually go and do a line by line correction. This could directly lead to introducing an error in the code!