1

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

Community
  • 1
  • 1
Joe
  • 11
  • 1
  • Also discussed in these questions http://stackoverflow.com/questions/241822/vb-runtime-functions-in-vb-net-for-vb6-programmers http://stackoverflow.com/questions/2030276/utility-to-convert-legacy-vb6-function-calls-to-net http://stackoverflow.com/questions/226517/is-the-microsoft-visualbasic-namespace-true-net-code – MarkJ Mar 13 '10 at 22:39
  • Also discussed in these other questions... - http://stackoverflow.com/questions/241822/vb-runtime-functions-in-vb-net-for-vb6-programmers - http://stackoverflow.com/questions/2030276/utility-to-convert-legacy-vb6-function-calls-to-net - http://stackoverflow.com/questions/226517/is-the-microsoft-visualbasic-namespace-true-net-code – MarkJ Mar 13 '10 at 22:40

3 Answers3

4

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 Sieker
  • 9,349
  • 2
  • 25
  • 43
  • 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 Mar 11 '10 at 17:20
  • 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 Sieker Mar 11 '10 at 19:33
0

backward compatibility

Fredou
  • 19,848
  • 10
  • 58
  • 113
  • Why is this more backwards compatible? I thought VB.Net was a supported language. – Joe Mar 11 '10 at 16:30
0

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
  • 399,467
  • 113
  • 570
  • 794