Question: How to end a macro running in C#

Hi,

Asking here because I've tried a few methods and neither of themworks for me..

In VBA I could just use the "end" statement to exit a macro thatwas running.

In VSTA (C#) I have a few dialogboxes and if the user choses"Cancel" on either one of them I want the macro to completely stoprunning...

Ive tried Environment.Exit(0); but that result in SW2009 crashing..
Application.Exit() just exits the form and continues the program..

Is there an obvious command that I am missing?

Thanks in advance!SolidworksApi macros