Convert.ToUInt64 (Decimal) converts decimal number to 64-bit unsigned integer.
Class Sample
Public Shared Sub Main()
Dim values() As Decimal = { Decimal.MinValue, -1.23d, -12d, 0d, 147d, _
199.55d, 2010.16d, Decimal.MaxValue }
Dim result As ULong
For Each value As Decimal In values
Try
result = Convert.ToUInt64(value)
Console.WriteLine(result)
Catch e As OverflowException
Console.WriteLine("The {0} value {1} is outside the range of the UInt64 type.", _
value.GetType().Name, value)
End Try
Next
End Sub
End Class
Related examples in the same category