本文整理匯總了VB.NET中System.Decimal.Implicit操作符的典型用法代碼示例。如果您正苦於以下問題:VB.NET Decimal.Implicit操作符的具體用法?VB.NET Decimal.Implicit怎麽用?VB.NET Decimal.Implicit使用的例子?那麽, 這裏精選的操作符代碼示例或許可以為您提供幫助。您也可以進一步了解該操作符所在類System.Decimal
的用法示例。
在下文中一共展示了Decimal.Implicit操作符的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Main
Module Example
Public Sub Main()
' Define an array of 32-bit unsigned integer values.
Dim values() As UInteger = { UInteger.MinValue, UInteger.MaxValue,
&hFFFFFF, 123456789, 4000000000 }
For Each value In values
Dim decValue As Decimal = value
Console.WriteLine("{0} ({1}) --> {2} ({3})", value,
value.GetType().Name, decValue,
decValue.GetType().Name)
Next
End Sub
End Module
輸出:
0 (UInt32) --> 0 (Decimal) 4294967295 (UInt32) --> 4294967295 (Decimal) 16777215 (UInt32) --> 16777215 (Decimal) 123456789 (UInt32) --> 123456789 (Decimal) 4000000000 (UInt32) --> 4000000000 (Decimal)
示例2: Main
Module Example
Public Sub Main()
' Define an array of 16-bit unsigned integer values.
Dim values() As Decimal = { UShort.MinValue, UShort.MaxValue,
&hFFF, 12345, 40000 }
' Convert each value to a Decimal.
For Each value In values
Dim decValue As Decimal = value
Console.WriteLine("{0} ({1}) --> {2} ({3})", value,
value.GetType().Name, decValue,
decValue.GetType().Name)
Next
End Sub
End Module
輸出:
0 (Decimal) --> 0 (Decimal) 65535 (Decimal) --> 65535 (Decimal) 4095 (Decimal) --> 4095 (Decimal) 12345 (Decimal) --> 12345 (Decimal) 40000 (Decimal) --> 40000 (Decimal)
示例3: Main
Module Example
Public Sub Main()
' Define an array of 8-bit signed integer values.
Dim values() As SByte = { SByte.MinValue, SByte.MaxValue,
&h3F, 123, -100 }
' Convert each value to a Decimal.
For Each value In values
Dim decValue As Decimal = value
Console.WriteLine("{0} ({1}) --> {2} ({3})", value,
value.GetType().Name, decValue,
decValue.GetType().Name)
Next
End Sub
End Module
輸出:
-128 (SByte) --> -128 (Decimal) 127 (SByte) --> 127 (Decimal) 63 (SByte) --> 63 (Decimal) 123 (SByte) --> 123 (Decimal) -100 (SByte) --> -100 (Decimal)
示例4: Main
Module Example
Public Sub Main()
' Define an array of 64-bit integer values.
Dim values() As Long = { Long.MinValue, Long.MaxValue,
&hFFFFFFFFFFFF, 123456789123456789,
-1000000000000000 }
' Convert each value to a Decimal.
For Each value In values
Dim decValue As Decimal = value
Console.WriteLine("{0} ({1}) --> {2} ({3})", value,
value.GetType().Name, decValue,
decValue.GetType().Name)
Next
End Sub
End Module
輸出:
-9223372036854775808 (Int64) --> -9223372036854775808 (Decimal) 9223372036854775807 (Int64) --> 9223372036854775807 (Decimal) 281474976710655 (Int64) --> 281474976710655 (Decimal) 123456789123456789 (Int64) --> 123456789123456789 (Decimal) -1000000000000000 (Int64) --> -1000000000000000 (Decimal)
示例5: Main
Module Example
Public Sub Main
' Define an array of byte values.
Dim values() As Byte = { Byte.MinValue, Byte.MaxValue,
&h3F, 123, 200 }
' Convert each value to a Decimal.
For Each value In values
Dim decValue As Decimal = value
Console.WriteLine("{0} ({1}) --> {2} ({3})", value,
value.GetType().Name, decValue,
decValue.GetType().Name)
Next
End Sub
End Module
輸出:
0 (Byte) --> 0 (Decimal) 255 (Byte) --> 255 (Decimal) 63 (Byte) --> 63 (Decimal) 123 (Byte) --> 123 (Decimal) 200 (Byte) --> 200 (Decimal)
示例6: Main
Module Example
Public Sub Main()
' Define an array of 16-bit integer values.
Dim values() As Short = { Short.MinValue, Short.MaxValue,
&hFFF, 12345, -10000 }
' Convert each value to a Decimal.
For Each value In values
Dim decValue As Decimal = value
Console.WriteLine("{0} ({1}) --> {2} ({3})", value,
value.GetType().Name, decValue,
decValue.GetType().Name)
Next
End Sub
End Module
輸出:
-32768 (Int16) --> -32768 (Decimal) 32767 (Int16) --> 32767 (Decimal) 4095 (Int16) --> 4095 (Decimal) 12345 (Int16) --> 12345 (Decimal) -10000 (Int16) --> -10000 (Decimal)
示例7: Example
Module Example
Public Sub Main()
' Define an array of Char values.
Dim values() As Char = { ChrW(0), " "c, "*"c, "A"c, "a"c,
"{"c, "Æ"c }
' Convert each Char value to a Decimal.
For Each value In values
Dim decValue As Decimal = Decimal.op_Implicit(value)
Console.WriteLine("'{0}' ({1}) --> {2} ({3})", value,
value.GetType().Name, decValue,
decValue.GetType().Name)
Next
End Sub
End Module
輸出:
(Char) --> 0 (Decimal) (Char) --> 32 (Decimal) *' (Char) --> 42 (Decimal) A' (Char) --> 65 (Decimal) a' (Char) --> 97 (Decimal) {' (Char) --> 123 (Decimal) Æ' (Char) --> 198 (Decimal)
示例8: Main
Module Example
Public Sub Main()
Dim values() As ULong = { ULong.MinValue, ULong.MaxValue,
&hFFFFFFFFFFFF, 123456789123456789,
1000000000000000 }
For Each value In values
Dim decValue As Decimal = value
Console.WriteLine("{0} ({1}) --> {2} ({3})", value,
value.GetType().Name, decValue,
decValue.GetType().Name)
Next
End Sub
End Module
輸出:
0 (UInt64) --> 0 (Decimal) 18446744073709551615 (UInt64) --> 18446744073709551615 (Decimal) 281474976710655 (UInt64) --> 281474976710655 (Decimal) 123456789123456789 (UInt64) --> 123456789123456789 (Decimal) 1000000000000000 (UInt64) --> 1000000000000000 (Decimal)
示例9: Main
Module Example
Public Sub Main()
' Define an array of 32-bit integer values.
Dim values() As Integer = { Integer.MinValue, Integer.MaxValue,
&hFFFFFF, 123456789, -1000000000 }
' Convert each value to a Decimal.
For Each value In values
Dim decValue As Decimal = value
Console.WriteLine("{0} ({1}) --> {2} ({3})", value,
value.GetType().Name, decValue,
decValue.GetType().Name)
Next
End Sub
End Module
輸出:
-2147483648 (Int32) --> -2147483648 (Decimal) 2147483647 (Int32) --> 2147483647 (Decimal) 16777215 (Int32) --> 16777215 (Decimal) 123456789 (Int32) --> 123456789 (Decimal) -1000000000 (Int32) --> -1000000000 (Decimal)