本文整理匯總了VB.NET中System.Environment.ExitCode屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET Environment.ExitCode屬性的具體用法?VB.NET Environment.ExitCode怎麽用?VB.NET Environment.ExitCode使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Environment
的用法示例。
在下文中一共展示了Environment.ExitCode屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Example
' 導入命名空間
Imports System.Numerics
Module Example
Private Const ERROR_BAD_ARGUMENTS As Integer = &hA0
Private Const ERROR_ARITHMETIC_OVERFLOW As Integer = &h216
Private Const ERROR_INVALID_COMMAND_LINE As Integer = &h667
Public Sub Main()
Dim args() As String = Environment.GetCommandLineArgs()
If args.Length = 1 Then
Environment.ExitCode = ERROR_INVALID_COMMAND_LINE
Else
Dim value As BigInteger = 0
If BigInteger.TryParse(args(1), value) Then
If value <= Int32.MinValue Or value >= Int32.MaxValue
Environment.ExitCode = ERROR_ARITHMETIC_OVERFLOW
Else
Console.WriteLine("Result: {0}", value * 2)
End If
Else
Environment.ExitCode = ERROR_BAD_ARGUMENTS
End If
End If
End Sub
End Module
示例2: Main
' 導入命名空間
Imports System.Numerics
Module Example
Private Const ERROR_SUCCESS As Integer = 0
Private Const ERROR_BAD_ARGUMENTS As Integer = &hA0
Private Const ERROR_ARITHMETIC_OVERFLOW As Integer = &h216
Private Const ERROR_INVALID_COMMAND_LINE As Integer = &h667
Public Function Main() As Integer
Dim args() As String = Environment.GetCommandLineArgs()
If args.Length = 1 Then
Return ERROR_INVALID_COMMAND_LINE
Else
Dim value As BigInteger = 0
If BigInteger.TryParse(args(1), value) Then
If value <= Int32.MinValue Or value >= Int32.MaxValue
Return ERROR_ARITHMETIC_OVERFLOW
Else
Console.WriteLine("Result: {0}", value * 2)
End If
Else
Return ERROR_BAD_ARGUMENTS
End If
End If
Return ERROR_SUCCESS
End Function
End Module
示例3: MainClass
' 導入命名空間
Imports System
Public Class MainClass
Shared Sub Main()
Console.WriteLine("ExitCode: " & System.Environment.ExitCode )
End Sub
End Class