- 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
Char.Equals() Method in C#
The Char.Equals() method in C# is used to return a value that indicates whether this instance is equal to a specified object or Char value.
Syntax
Following is the syntax −
public bool Equals (char ob);
Above, ob is an object to compare to this instance.
Example
Let us now see an example to implement the Char.Equals() method −
using System; public class Demo { public static void Main(){ char val = 'A'; bool res; res = val.Equals('A'); Console.WriteLine("Return Value = "+res); } }
Output
This will produce the following output −
Return Value = True
Example
Let us now see another example −
using System; public class Demo { public static void Main(){ char val = 'H'; bool res; res = val.Equals('d'); Console.WriteLine("Return Value = "+res); } }
Output
This will produce the following output −
Return Value = False
Advertisements