Home >Backend Development >C#.Net Tutorial >BigInteger class in C#
Use BigInteger in C# to handle large numbers. The assembly to add for BigInteger is System. numerical value.
In C#, big integers are located in System.Numerics.BigInteger.
Syntax of BigInteger-
[SerializableAttribute] public struct BigInteger : IFormattable, IComparable, IComparable<BigInteger>, IEquatable<BigInteger>
Let’s see a sample code snippet-
BigInteger num = BigInteger.Multiply(Int64.MaxValue, Int64.MaxValue);
You can create a BigInteger like this-
BigInteger num = new BigInteger(double.MaxValue);
The following are some of its constructors-
S.No. | Constructor and description |
---|---|
1 | ##BigInteger(Byte[ ])A new instance of the BigInteger structure using the values in the byte array. p> |
td> |
BigInteger(Decimal)Use Decimal value A new instance of the BigInteger structure. |
BigInteger(Double)Use double precision A new instance of a BigInteger structure with a floating-point value.
|
|
BigInteger(Int32)Use 32 bits A new instance of a BigInteger structure for signed integer values. |
The above is the detailed content of BigInteger class in C#. For more information, please follow other related articles on the PHP Chinese website!