tags:

views:

67

answers:

4

What reasons are there to migrate from vb.net specific language to .net framework language? Examples:

VB.net

ubound
msgBox

.Net Framework

array.getUpperBound(0)
messageBox

A: 

backward compatibility

Fredou
Why is this more backwards compatible? I thought VB.Net was a supported language.
Joe
+4  A: 

Those functions exist to mirror the built-ins in VB6, to make porting code easier.

The functions in the Microsoft.VisualBasic namespace are often then wrappers around the .Net functions, with some additional checks before calling the function, so there's a minor performance hit using them vs. the native ones.

Matt S
This sounds like a great reason. Is there any official MS documentation that describes these functions as wrappers? I'm having trouble finding it myself.
Joe
http://msdn.microsoft.com/en-us/library/aa289509(VS.71).aspx seems to be the closest. More specifically, the "Visual Basic Runtime" section outlines the functions of the namespace, as well as what they use internally. It also says what they do can be examined with Ildasm (or Reflector).
Matt S
A: 

VB.Net is a ".net framework language". The examples you showed for .Net work just fine in VB. So, in that sense you would not be migrating from anything. As to why you should prefer the newer .net idioms over the older vb-specific idioms, there are many reasons:

  • The newer code is more portable
  • It uses more modern programming concepts, and therefore subtly encourages better habits
  • The newer code is sometimes faster
  • The newer code has more features. For example, you can set more styles on the new MessageBox than you can the old MsgBox.
  • Sometimes neither is the best choice. For example, if you're using arrays much at all in .Net 2.0 and later you're doing something wrong. IEnumerable(Of T) and the various generic collection types are much to be preferred.
Joel Coehoorn