本文整理匯總了VB.NET中System.Int16.MaxValue字段的典型用法代碼示例。如果您正苦於以下問題:VB.NET Int16.MaxValue字段的具體用法?VB.NET Int16.MaxValue怎麽用?VB.NET Int16.MaxValue使用的例子?那麽, 這裏精選的字段代碼示例或許可以為您提供幫助。
在下文中一共展示了Int16.MaxValue字段的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: numbersToConvert
Dim numbersToConvert() As Long = {162345, 32183, -54000}
Dim newNumber As Int16
For Each number As Long In NumbersToConvert
If number >= Int16.MinValue And number <= Int16.MaxValue Then
newNumber = Convert.ToInt16(number)
Console.WriteLine("Successfully converted {0} to an Int16.", _
newNumber)
Else
Console.WriteLine("Unable to convert {0} to an Int16.", number)
End If
Next
輸出:
Unable to convert 162345 to an Int16. Successfully converted 32183 to an Int16. Unable to convert -54000 to an Int16.