While searching on the Internet and reading material regarding what is new in the framework 4 I come across the new data type which I have not see in the previous version of the dot net framework. The new data type is the BigInteger type. The BigInteger data type is used to store large amount of data. Like the other data type such as Int16, Int32 etc which has the MixValue and the MaxValue properties which define the lower bound and upper bound supported by that data type. In contrast, the BigInteger structure has no lower or upper bound, and can contain the value of any integer. The BigInteger data type is defined in the System.Numerics namespace. The System.Numerics namespace can be added as shown in the Image 1 as System.Numerics is not added by default in the project you have to add the reference in your project.
Image 1 |
The System.Numerics has only two data type one is the BigInteger (Represents an arbitrarily large signed integer.) and the second one is the Complex (Represents a complex number).For this post I will discuss only the BigInteger data type. The BigInteger type is an immutable (e.g if you increment or decrement the value of the BigInteger object value then the common language run time actually creates a new BigInteger object and assigns it a value one greater/ one less than its previous value. This new object is then returned to the caller.) type that represents an arbitrarily large integer whose value in theory has no upper or lower bounds.
List 1
Image 2 |
The IsPowerOfTwo property will return true false depending on the value of the bigInteger object value.The sign property return the integer value which indicate the sign with the bigInteger object. Sign property is only return the sign you can't set the sign. The sign property will return three values depending on the sign with the bigInteger object. -1 (minus one) indicate the -ve sign with the bigInteger object , 0 indicate the value of the bigInteger value is 0 and 1 indicate +ve sign with the bigInteger object.
All and any comments / bugs / suggestions are welcomed !