VB.NET: Return vs Exit Sub


The other day I was suddenly wondering which one is better for exiting a Sub, return or exit?

If you inspect the IL output of the 2 statements, they are the same. However, since  ‘return’ is meant for pushing something back to the caller, so strictly speaking, ‘Exit Sub’ is more suitable for using in a Sub. See the discussion here.

PS. IL is an assembly language usually used to debug .NET code at low level. See here for more.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s