tags:

views:

738

answers:

2

I know about Application.Exit() but what if I'm not in a windows forms application but in a simple class library, how do I signal for the application to exit?

+2  A: 

P/Invoke ExitProcess, perhaps. Or if you're really in a hurry, TerminateProcess.

Chris Charabaruk
Is there no .NET BCL way to do this?!!
George Mauer
Other than returning from the entry point, no.
Chris Charabaruk
+4  A: 

Environment.Exit() -- but why would you ever want to do this from a method in a class library?

tvanfosson
Forgot about this. It's probably better than my P/Invoke suggestions.
Chris Charabaruk
Mind you - this requires extra security privileges (really wish it didn't...) - specifically, executing unmanaged code.
romkyns