BigInteger in C#

The max value for an integer(int64) is "9223372036854775807" (According to my calculation).

But you can calculate greater numbers using BigInteger.

To get started.

First you must add reference to System.Numerics.

Given the code below; simply multiplies 2 int64 numbers:

BigInteger big = BigInteger.Multiply(Int64.MaxValue, Int64.MaxValue);

textBox3.Text = big.ToString();

And result is:

85070591730234615847396907784232501249 (a 38-digit number)

You can use BigInteger to calculate big numbers.

Hope it helps


Similar Articles