- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Int64.Equals Method in C# with Examples
The Int64.Equals() method in C# is used to return a value indicating whether this instance is equal to a specified object or Int64.
Syntax
Following is the syntax −
public bool Equals (long ob); public override bool Equals (object ob);
Above, the parameter ob is an Int64 value to compare to this instance, whereas the parameter ob is an object to compare with this instance.
Example
Let us now see an example to implement the Int64.Equals() method −
using System; public class Demo { public static void Main(){ long val1 = 150; long val2 = 240; Console.WriteLine("Value1 = "+val1); Console.WriteLine("Value2 = "+val2); Console.WriteLine("Are they equal? = "+val1.Equals(val2)); } }
Output
This will produce the following output −
Value1 = 150 Value2 = 240 Are they equal? = False
Example
Let us now see another example to implement the Int64.Equals() method −
using System; public class Demo { public static void Main(){ long val1 = 8768768768; long val2 = 8768768768; Console.WriteLine("Value1 = "+val1); Console.WriteLine("Value2 = "+val2); Console.WriteLine("Are they equal? = "+val1.Equals(val2)); } }
Output
This will produce the following output −
Value1 = 8768768768 Value2 = 8768768768 Are they equal? = True
Advertisements