- 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
Boolean.Equals(Object) Method in C#
The Boolean.Equals(Object) method in C# returns a value indicating whether this instance is equal to a specified object.
Syntax
Following is the syntax −
public override bool Equals (object ob);
Above, ob is an object to compare to this instance.
Example
Let us now see an example to implement the Boolean.Equals(Object) method −
using System; public class Demo { public static void Main(){ bool val1 = true; object val2 = 5/10; if (val1.Equals(val2)) Console.WriteLine("Both are equal!"); else Console.WriteLine("Both aren't equal!"); } }
Output
This will produce the following output −
Both aren't equal!
Advertisements