- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
BigInteger Class in C#
Use the BigInteger to handle big numbers in C#. The assembly to add for BigInteger is System. Numerics.
In c# Big integer is found in System.Numerics.BigInteger.
Syntax
The syntax of BigInteger −
[SerializableAttribute] public struct BigInteger : IFormattable, IComparable, IComparable<BigInteger>, IEquatable<BigInteger>
Let us see an example code snippet −
BigInteger num = BigInteger.Multiply(Int64.MaxValue, Int64.MaxValue);
You can create BigInteger like this −
BigInteger num = new BigInteger(double.MaxValue);
The following are some of its constructors −
S.No. | Constructor & Description |
---|---|
1 | BigInteger(Byte[ ]) A new instance of the BigInteger structure using the values in a byte array. |
2 | BigInteger(Decimal) A new instance of the BigInteger structure using a Decimal value. |
3 | BigInteger(Double) A new instance of the BigInteger structure using a double-precision floating-point value. |
4 | BigInteger(Int32) A new instance of the BigInteger structure using a 32-bit signed integer value. |
Advertisements