// use System
using System;
// create class
class EqualityChecker
{
// main method
static void Main()
{
See AlsoHow to compare Objects in TypeScript | bobbyhadz.NET == and .Equals() – Passion for CodingDifference between == and .Equals method in c#Equality operators - test if two objects are equal or not equal - C#// create some values
string name = "Johnny";
string platform = "Edpresso";
bool isGreat = true;
bool isHard = false;
bool isCSharp = true;
int num1 = 3 + 4; // = 7
int num2 = 5 + 6; // = 13
See AlsoCompare strings in C#// compare them using
// the `Equals()` method
PrintEquals((string)name, (string)platform);
PrintEquals(name, name);
PrintEquals(isGreat, isHard);
PrintEquals(isGreat, isCSharp);
PrintEquals(num1, num2);
PrintEquals(num1, num1);
}
// check string objects method
static void PrintEquals(object obj1, object obj2){
if(obj1.Equals(obj2)){
Console.WriteLine("Both of the values are equal");
}else{
Console.WriteLine("Both of the values are not equal");
}
}
}
Educative Answers - Trusted Answers to Developer Questions (2024)
Top Articles
Géneros que forman parte de la música tradicional venezolana - Venezolanos Ilustres
🥗Eslogan de comida saludable: guía para crear uno
Karin Gringer working at Moog Medical Devices Group
Shirley Saludo working at Moog Controls Corporation (philippine Branch)
Canvas Login Concorde
Everything to Know About The Voice Season 25 Finalist Asher HaVon
The 22 best restaurants to try in Everglades National Park
The 15 Best Mahi Mahi Fishing Charters in St. Pete Beach
Melinda Molansky Obituary
Craigslist Johnstown Altoona
Tri State Homepage Weather
2023 Women's Soccer Schedule
Latest Posts
La “traición” de Reino Unido por la que Belice y Guatemala viven un conflicto fronterizo siglos después
Saiba como consultar quanto tempo falta para a aposentadoria do INSS
Article information
Author: Dong Thiel
Last Updated:
Views: 6377
Rating: 4.9 / 5 (79 voted)
Reviews: 94% of readers found this page helpful
Author information
Name: Dong Thiel
Birthday: 2001-07-14
Address: 2865 Kasha Unions, West Corrinne, AK 05708-1071
Phone: +3512198379449
Job: Design Planner
Hobby: Graffiti, Foreign language learning, Gambling, Metalworking, Rowing, Sculling, Sewing
Introduction: My name is Dong Thiel, I am a brainy, happy, tasty, lively, splendid, talented, cooperative person who loves writing and wants to share my knowledge and understanding with you.