Since about a year and a half I have not written any line of code in C# anymore. Currently all my development efforts – both with my employer and with Sailsoft – are concentrated around VB.Net.
For some reason it just happend last week that I had to develop an application for Windows Mobile devices where C# was a requirement. No problem, I’ve been developing in C# for years, n’est ce pas?
So I fired up Visual Studio 2008, told it that I wanted a C# Windows Mobile template and off I went.
I typed the first line of code: “imports system.collections.generic“, making up for the second line. Ah, a red cringle under “imports”. Yeah, of course, C# wants “using” here instead of the VB “imports”, no problem.
OK, next line. Ah, oh no, again a red worm at the end of the statement. Yes of course, this is C#, statements have to be concluded with a semi colon, remember you stupid?
OK, that should be it then, what more could go wrong. At this point I had already lost about half of my self confidence I started off with, so just to make sure before continuing, lets see if it builds. Press F5. Hello, error? “The type or namespace name ‘system’ could not be found (are you missing a using directive or an assembly reference?)” Sh.., what is that? Namespace ‘system’ not found? Am I missing something here? Do I maybe need to add an external reference to ‘system’ namespace in this version of VS2008?
I seriously considered reverting to my comfortable VB.Net. Just in time I remembered the case sensitivity of C# and I swiftly corrected the statement. Ah, what a relieve.
In the mean time I had already lost about 10 minutes with just one line of code, so I had to pick up speed fast when I still wanted this app finished in the hour or so I had planned for it.
Let me spare you all the frustrations I went through the next few hours or so.
Missing semi colons, forgotten parenthesis after method names, intellisense that did not work as I was used to in VB, character casing, type casting, unmatching brackets, explicit delegate and event handler declarations, etceteras, etceteras.
It is amazing how fast one can forget the syntaxis of a language when used to the comfort and forgiveness a programming language like VB.Net offers.
Some colleague developers do not find it prudent to favorite VB. Some believe C# is a better language since it forces very strict rules upon a programmer, and that this means that C# therefore is less prone to making errors.
In my opinion this is nonsense and that both VB.Net and C# are equally good or bad. VB.Net has come a long way from Basic and is only remotely releated today. What has remained are the intuitive syntaxis and flexibility. Combined with the powerful editor in Visual Studio, VB.Net currently is the programming language of choice for me.
Note 1: I always felt that I never lost my 30 years old COBOL skills and that I just needed to start coding in order to write a fresh new COBOL program from scratch. But now the doubt has crept in…
Note 2: The title of this article and the image I borrowed from Beth Massi’s blog with permission.