Environment.ExitCode プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)

/** @property */ public static int get_ExitCode () /** @property */ public static void set_ExitCode (int value)
終了コードを格納している 32 ビット符号付き整数。既定値は 0 です。

このプロパティを使用して、アプリケーションから成功コードを返すことができます。たとえば、1 つのスクリプトで起動される一連のアプリケーションの実行を制御できます。アプリケーションがこのプロパティの値を設定しない場合は、0 が返されます。
ユーザーがこのプロパティを設定するかどうかにかかわらず、システム終了コードは main 関数の戻り値に設定され、main が void を返す場合には 0 に設定されます。

アプリケーション自身の終了コードを表示するコード例を次に示します。
' Sample for the Environment.ExitCode property Imports System Class Sample Public Shared Sub Main() Console.WriteLine() Console.WriteLine("ExitCode: {0}", Environment.ExitCode) End Sub 'Main End Class 'Sample ' 'This example produces the following results: ' 'ExitCode: 0 '
// Sample for the Environment.ExitCode property using System; class Sample { public static void Main() { Console.WriteLine(); Console.WriteLine("ExitCode: {0}", Environment.ExitCode); } } /* This example produces the following results: ExitCode: 0 */
// Sample for the Environment::ExitCode property using namespace System; int main() { Console::WriteLine(); Console::WriteLine( "ExitCode: {0}", Environment::ExitCode ); } /* This example produces the following results: ExitCode: 0 */
// Sample for the Environment.ExitCode property import System.*; class Sample { public static void main(String[] args) { Console.WriteLine(); Console.WriteLine("ExitCode: {0}", System.Convert.ToString(Environment.get_ExitCode())); } //main } //Sample /* This example produces the following results: ExitCode: 0 */

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からEnvironment.ExitCode プロパティを検索する場合は、下記のリンクをクリックしてください。

- Environment.ExitCode プロパティのページへのリンク