Compiler support for "Exit For"

  • Thread starter Thread starter Steve Long
  • Start date Start date
S

Steve Long

Hello,
does anybody know if the built in support for the "Exit For" statement is
just a left over from earier versions of VB and therefore inefficient or if
it's truely a VB.NET language feature?
The reason I ask is because even though the "On Error Goto" statement is
still available in .NET, if you use it, it wraps a Try/Catch block around
each line of code in that routine from what I understand. If "Exit For" does
anything as inefficient as that, I certainly wouldn't want to use it.

Can someone in the know address this?

Thanks
Steve
 
Steve Long said:
does anybody know if the built in support for the "Exit For" statement is
just a left over from earier versions of VB and therefore inefficient or if
it's truely a VB.NET language feature?

It's truly a language feature and there are no reasons for removing it in a
future version. It just performs a jump.
The reason I ask is because even though the "On Error Goto" statement is
still available in .NET, if you use it, it wraps a Try/Catch block around
each line of code in that routine from what I understand.

Unstructured error handling is a language feature too. It's part of the
language and it's sometimes a nice shortcut. You should not matter about
the IL that is generated by the compiler too much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top