George Mauer
George Mauer

Reputation: 122212

C#: Non-Winforms way to exit the application?

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?

Upvotes: 5

Views: 2564

Answers (2)

tvanfosson
tvanfosson

Reputation: 532665

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

Upvotes: 9

Chris Charabaruk
Chris Charabaruk

Reputation: 4417

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

Upvotes: 3

Related Questions