Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Compare this instance is equal to a specified object or Int64 in C#
To compare this instance is equal to a specified object or Int64, the code is as follows −
Example
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 see another example −
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