C# BigInteger Equals(BigInteger)
Description
BigInteger Equals(BigInteger)
Returns a value that
indicates whether the current instance and a specified BigInteger object
have the same value.
Syntax
BigInteger.Equals(BigInteger)
has the following syntax.
public bool Equals(
BigInteger other
)
Parameters
BigInteger.Equals(BigInteger)
has the following parameters.
other
- The object to compare.
Returns
BigInteger.Equals(BigInteger)
method returns true if this BigInteger object and other have the same value; otherwise,
false.
Example
using System;// w w w. ja va 2 s .c o m
using System.IO;
using System.Numerics;
public class Example
{
public static void Main()
{
const long LIGHT_YEAR = 5878625373183;
BigInteger altairDistance = 17 * LIGHT_YEAR;
BigInteger epsilonIndiDistance = 12 * LIGHT_YEAR;
BigInteger ursaeMajoris47Distance = 46 * LIGHT_YEAR;
long tauCetiDistance = 12 * LIGHT_YEAR;
ulong procyon2Distance = 12 * LIGHT_YEAR;
object wolf424ABDistance = 14 * LIGHT_YEAR;
Console.WriteLine(" Altair: {0}",
epsilonIndiDistance.Equals(altairDistance));
Console.WriteLine(" Ursae Majoris 47: {0}",
epsilonIndiDistance.Equals(ursaeMajoris47Distance));
Console.WriteLine(" TauCeti: {0}",
epsilonIndiDistance.Equals(tauCetiDistance));
Console.WriteLine(" Procyon 2: {0}",
epsilonIndiDistance.Equals(procyon2Distance));
Console.WriteLine(" Wolf 424 AB: {0}",
epsilonIndiDistance.Equals(wolf424ABDistance));
}
}
The code above generates the following result.