C# BigInteger Equals(Object)

Description

BigInteger Equals(Object) Returns a value that indicates whether the current instance and a specified object have the same value.

Syntax

BigInteger.Equals(Object) has the following syntax.


public override bool Equals(
  Object obj
)

Parameters

BigInteger.Equals(Object) has the following parameters.

  • obj - The object to compare.

Returns

BigInteger.Equals(Object) method returns true if the obj parameter is a BigInteger object or a type capable of implicit conversion to a BigInteger value, and its value is equal to the value of the current BigInteger object; otherwise, false.

Example


using System;// w  w  w.  j a v a 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(epsilonIndiDistance.Equals(wolf424ABDistance));
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Numerics »




BigInteger
Complex