Thursday, January 24, 2008

Temporary Switch Back: C# to VB.NET

{

I did the switch back for a project that a VBA enlightened client requested but I kept finding myself asking how to syntactically do what I usually do in C# (especially inheritance-wise) in VB.NET.  Terry Smith has a handy online book that has a comparison so that you can easily figure out what the VB.NET syntax is for what you know how to do in C#. I'm not sure when it was written; no word on Generics but that's an easy enough syntax to duplicate with (Of T) rather than angle brackets.  What throws me off in addition to the inheritance verbosity are a lot of the array related casting operations that seem intuitive now in C# like:

Dim dropRows As Row() = e.Data.GetData(GetType(Row()))

Of course with the latest developments in VB.NET, I may end up using the language enough to make all of this easy to recall from memory. 

As much as I want to join the Red Sox fans in cheering for VB, there are still many things that annoy me about the language.  Line continuation characters are at the top of the list, and case insensitivity closely following. Yes, I strongly dislike case insensitivity in a programming language.

}

1 comment:

Terry Smith said...

Hey David,

Thanks for the link to my eBook!

It's getting a bit dated now I admit. I haven't updated it since .NET 1.1.

I'm glad some folks are still finding it useful though!

Terry