Mega Code Archive

 
Categories / VB.Net / Data Types
 

Compares BigInteger to other data type

Imports System Imports System.IO Imports System.Numerics Imports System.Runtime.Serialization.Formatters.Binary Module Example    Public Sub Main()         Dim values() As Object = { BigInteger.Pow(Int64.MaxValue, 10), Nothing, 12.534, Int64.MaxValue, BigInteger.One }         Dim number As BigInteger = UInt64.MaxValue                  For Each value As Object In values            Try               Console.WriteLine("Comparing {0} with '{1}': {2}", number, value, number.CompareTo(value))            Catch e As ArgumentException               Console.WriteLine("Unable to compare the {0} value {1} with a BigInteger.",value.GetType().Name, value)            End Try                              Next                                     End Sub End Module