本文整理汇总了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