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