This topic has not yet been rated - Rate this topic

BigInteger Properties

The BigInteger type exposes the following members.

  Name Description
Public property IsEven Indicates whether the value of the current BigInteger object is an even number.
Public property IsOne Indicates whether the value of the current BigInteger object is BigInteger.One.
Public property IsPowerOfTwo Indicates whether the value of the current BigInteger object is a power of two.
Public property IsZero Indicates whether the value of the current BigInteger object is BigInteger.Zero.
Public property Static member MinusOne Gets a value that represents the number negative one (-1).
Public property Static member One Gets a value that represents the number one (1).
Public property Sign Gets a number that indicates the sign (negative, positive, or zero) of the current BigInteger object.
Public property Static member Zero Gets a value that represents the number 0 (zero).
Top
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Sample of Static Properties using PowerShell
<#
.SYNOPSIS
This script displays statoc properties of a BigInteger
.DESCRIPTION
This script demonstrates the static properties of the BigInteger class.
.NOTES
File Name : Get-BigIntegerStaticProperties.ps1
Author : Thomas Lee - tfl@psp.co.uk
Requires : PowerShell Version 2.0
.NET Framework 4
.LINK
This script posted to:
http://www.pshscripts.blogspot.com
MSDN Sample posted at:
http://msdn.microsoft.com/en-us/library/system.numerics.biginteger_properties.aspx
.EXAMPLE
PSH [C:\foo]: .\Get-BigIntegerStaticProperties.ps1
MinusOne: -1
Zero : 0
One : 1
#>

# Add the .NET Version 4 System.Numerics namespace
$return = [System.Reflection.Assembly]::LoadWithPartialName("System.Numerics")

# Display the static properties of BigIntegerClass
" MinusOne: {0}" -f [System.Numerics.BigInteger]::MinusOne
" Zero : {0}" -f [System.Numerics.BigInteger]::Zero
" One : {0}" -f [System.Numerics.BigInteger]::One

Sample using PowerShell
<#
.SYNOPSIS
This script displays dynamic properties of a BigInteger
.DESCRIPTION
This script demonstates the properties on an instance of BigInteger
.NOTES
File Name : Get-BigIntegerProperties.ps1
Author : Thomas Lee - tfl@psp.co.uk
Requires : PowerShell Version 2.0
.NET Framework 4
.LINK
This script posted to:
http://www.pshscripts.blogspot.com
MSDN Sample posted at:
http://msdn.microsoft.com/en-us/library/system.numerics.biginteger_properties.aspx
.EXAMPLE
PSH [c:\foo]: .\Get-BigIntegerProperties.ps1
Big Integer from 4096:

IsPowerOfTwo : True
IsZero : False
IsOne : False
IsEven : True
Sign : 1
#>

# Add the .NET Version 4 System.Numerics.Dll
Add-Type -Path "C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Numerics.dll"

# Create a big integer then display it's key properties
$BigInt = New-object System.Numerics.BigInteger 4096
"Big Integer from 4096:"
$BigIntFromDouble | fl *