Int64.Equals() Method is used to get a value that shows whether the current instance is equal to a specified object or Int64. There are 2 methods in the overload list of this method as follows:
- Equals(Int64) Method
- Equals(Object) Method
Int64.Equals(Int64)
This method is used to return a value indicating whether the current instance is equal to a specified Int64 value or not.
Syntax: public bool Equals (long obj);
Here, it takes a Int64 value to compare to this instance.
Return Value: This method returns true if obj has the same value as this instance otherwise, false.
Below programs illustrate the use of
Int64.Equals(Int64) Method:
Example 1:
Output:
45643242 is not equal to 2564233
Example 2:
Output:
44355 is not equal to 578
423445 is equal to 423445
12560 is not equal to 28960
778 is not equal to 798
Int64.Equals(Object) Method
This method is used to returns a value indicating whether the current instance is equal to a specified object or not.
Syntax: public override bool Equals (object obj);
Here, it takes an object to compare with this instance.
Return Value: This method returns true if obj is an instance of Int64 and equals the value of this instance otherwise, false.
Below programs illustrate the use of the above-discussed method:
Example 1:
Output:
1879650 is not equal to 0
Example 2: