Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8456261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:30:09+00:00 2026-06-10T12:30:09+00:00

I read a lot of things here on stackoverflow, comments, opinions and every kind

  • 0

I read a lot of things here on stackoverflow, comments, opinions and every kind of ideas. But anyway, I really need an explained way to exit my console application (I’m on VS2010 Framework 4) on C# with a custom error.

The best thing I could read right now is on VB:

Private Declare Sub ExitProcess Lib "kernel32" (ByVal uExitCode As Long)

and use ExitProcess(1) for an error or ExitProcess(0)

So my questions are:

  • Is the same than Environment.Exit(1) ?
  • What is the better for an application that runs as automatic job?
  • What means the exit codes, -1, 0, 1, and what are their differences?
  • What about static void ExitProcess(uint uExitCode); ?

Some previously questions marked as bibliography:

What is the command to exit a Console application in C#?

http://geekswithblogs.net/mtreadwell/archive/2004/06/06/6123.aspx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T12:30:10+00:00Added an answer on June 10, 2026 at 12:30 pm

    You can:

    1. Call Environment.Exit(int)
    2. Re-declare your Main function as returning int, and return the value from it.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I read a lot of things here on SO and on the web but
I read a lot of different opinions on it, but is WinRT an actual
I read a lot, also here, but couldn't find a simple way to do
I've read a lot on this topic already both here (e.g., stackoverflow.com/questions/1713554/threads-processes-vs-multithreading-multi-core-multiprocessor-how-they-are or multi-CPU,
I read now a few days here and i learn a lot of things.
I've read a lot of similar questions, but I can't seem to find an
I have read several interesting C#/F# comparisons here on stackoverflow. So, first of all,
I've read this (References Explained) , this stackoverflow (I say this to avoid duplicates
I've read a lot of good things about Land of Lisp so I thought
As I read here http://arunatennakoon.blogspot.com/2010/11/things-i-learn-new-this-week.html Friday, November 12, 2010 Things I learn new this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.