GOTO still alive and kicking in .NET


In a VB.NET project, select a number (any number- they all give equally bad results), type it in on an empty line inside a method and see what happens. 

<rant> Will MS please lay this horrible programming practice to rest?  Back in the early `80s BillG didn't know any better, but common - give us a break!  There are already too many of these STUPID features which will never go away just for the sake of backwards compatibility. </rant>

Comments (3)
  1. Umm…Goto is supported (though not commonly used) in almost all programming languages. Try decompiling some of the base .NET classes…you’ll see Goto all over the place…

  2. It is not encouraged as an ongoing practice, but at least this way if you’ve put labels into your 100,000 lines of VB6 code it won’t break when you try to compile in VB.NET

  3. Jesse Ezell says:

    There are some cases where goto actually produces a lot cleaner code than any of the alternative methods. I generally have a strong dislike of goto, and I wouldn’t be totally upset if it was gone, but there are definately reasons (backwards compatibility not being one of them) to keep goto in the language.

Comments are closed.

Skip to main content