从C#控制台应用程序退出 [英] Exit from a console application in C#

查看:1118
本文介绍了从C#控制台应用程序退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的计算器,评论,意见和各种想法看了很多的东西在这里。但无论如何,我真的需要一个解释的方式来退出我的控制台应用程序(我在VS2010框架4)C#与自定义错误。

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.

我可以在最好的事情现在读的是VB的:

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

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

和使用了ExitProcess(1)错误或ExitProcess的(0)

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

所以,我的问题是:


  • 比Environment.Exit(1)

  • 相同<李>什么是为运行自动作业的应用程序?
    什么是指退出代码,-1,0,1,和他们有什么区别?
  • 有关静态无效了ExitProcess(UINT uExitCode)什么; ?

  • 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是退出命令的C#的控制台应用程序?

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

推荐答案

您可以:


  1. 通话Environment.Exit(INT)

  2. 重新申报的主要功能为返回int,并从它返回值

这篇关于从C#控制台应用程序退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆