Exit Function

Can anyone give me the equivalent command for Exit Function or Exit Sub in C#?

Regards
Pradeep
LVL 7
pradeepsudharsanAsked:
Who is Participating?
 
t_itaniumConnect With a Mentor Commented:
yes you can do that by another way around :)

 private void button1_Click(object sender, EventArgs e)
{
            MessageBox.Show("it is displayed");

            goto end;

            MessageBox.Show("it is not displayed");

            end: {}
 }

when reaching the goto function it will go to the end of the function and end it...

cheers
0
 
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
Use "return"...

        private void button1_Click(object sender, EventArgs e)
        {
            Debug.WriteLine("the code below");

            return;

            Debug.WriteLine("will never be reached...");
        }
0
 
pradeepsudharsanAuthor Commented:
any other command?
0
All Courses

From novice to tech pro — start learning today.