Mega Code Archive

 
Categories / C# / Data Types
 

Converts string in a specified style to BigInteger

using System; using System.Globalization; using System.Numerics; public class Example {    public static void Main()    {       string[] hexStrings = { "80", "0080", "00E293", "00F9A2FF", "00FFFFFFFF" };       foreach (string hexString in hexStrings)       {          BigInteger number = BigInteger.Parse(hexString, NumberStyles.AllowHexSpecifier);          Console.WriteLine("Converted 0x{0} to {1}.", hexString, number);       }             } }