Mega Code Archive

 
Categories / VB.Net / Development
 

Convert ToInt64 (Double) converts double-precision floating-point number to 64-bit signed integer

Module Example    Public Sub Main()         Dim values() As Double = { Double.MinValue, -1.38e10, -2010.299, -12.98, _                                    0, 9.113e-16, 10.19, 2010.191, Double.MaxValue }         Dim result As Long                  For Each value As Double In values            Try               result = Convert.ToInt64(value)               Console.WriteLine(result)            Catch e As OverflowException               Console.WriteLine("{0} is outside the range of the Int64 type.", value)            End Try            Next                                     End Sub End Module