What is idiomatic way to convert standard hexadecimal string (like "0x0123") to BigInteger in C#?
What I tried requires removing the hex prefix manually:
using System;
using System.Numerics;
using System.Globalization;
namespace TestHex
{
class Program
{
static void Main(string[] args)
{
BigInteger A;
// it does not work
// A = BigInteger.Parse("0x0123");
// it works, but without hex prefix
A = BigInteger.Parse("123", NumberStyles.AllowHexSpecifier);
Console.WriteLine(A);
Console.ReadLine();
}
}
}