Mega Code Archive

 
Categories / VB.Net / Development
 

Convert ToUInt64 (Single) converts single-precision floating-point number to 64-bit unsigned integer

Class Sample    Public Shared Sub Main()            Dim values() As Single = { Single.MinValue, -1.38e10,0, 9.113e-16,Single.MaxValue }            Dim result As ULong                     For Each value As Single 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