Imports System.Numerics
Imports System
Module Example
Public Sub Main()
Dim goodByte As BigInteger = BigInteger.One
Dim badByte As BigInteger = 256
Dim byteFromBigInteger As Byte
byteFromBigInteger = CType(goodByte, Byte)
Console.WriteLine(byteFromBigInteger)
byteFromBigInteger = CByte(goodByte)
Console.WriteLine(byteFromBigInteger)
Try
byteFromBigInteger = CType(badByte, Byte)
Console.WriteLine(byteFromBigInteger)
Catch e As OverflowException
Console.WriteLine("Unable to convert {0}:{1} {2}", badByte, vbCrLf, e.Message)
End Try
End Sub
End Module