How can to check if two object values are equal in C# (2024)

// use System

using System;

// create class

class EqualityChecker

{

// main method

static void Main()

{

// 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

// 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");

}

}

}

How can to check if two object values are equal in C# (2024)
Top Articles
Which Pet Insurance Is The Best?
Our Ultimate Plan to Retire at 45 and Achieve Financial Freedom
myrtle beach motorcycles/scooters - by dealer - craigslist
Uconn. Bursar Office
Paperman And Sons Obituary
Romans 2 Esv
Account Now Login In
Filing of beneficial ownership details with the Register of Beneficial Owners
Book a Cruise | Search Cruise Holidays | P&O Cruises
violinplot - Violin plot - MATLAB
Randi Weingarten Children
Wow Pickaxe Blade
Metv Plus Schedule Today Near Texas
Attorney withdraws, trial is delayed for man accused of killing 2 Eagle Mountain boys
Blueway Truck Sales
South Bend Weather Underground
Tcu Jaggaer
Baptist Medical Center Yazoo Photos
My Unt Hr
Oviedo Anonib
Sevierville, Tennessee: Idyllisches Reiseziel in den Great Smoky Mountains
Tmc Vidown
6Ar6Ie Leaked
World's Most Expensive Tiles | Buy Premium & Luxurious Tiles at Ramirro Ceramica
9546647572
Hallmark Greeting Card Contest 2022
Tutorial - PyMuPDF 1.24.10 documentation
R&J Travel And Tours Calendar
Unblocked Games Amazon
Pay Dates For Nc State Retirees
Montefiore Email Outlook Login
Craigslist Snowblower
Jayripk Death Video
Sam's Club Reynoldsburg Gas Price
Ellen Knight Casper Wyoming
763-298-8022
Where Are Rice Cakes In Walmart
Margie's Money Saver Hey Dudes
9294027542
Melissa N. Comics
Pwc Trader Florida
Ky Lottery Winners 2022
Black Gelato Strain Allbud
House Party 2023 Showtimes Near Cinemark Oakley Station And Xd
Bbc Weather Milton Keynes
Rubmd Columbus Ohio
Best New England Boarding Schools
Lovein Funeral Obits
Mals Crazy Crab
Derpixon Kemono
7543460065
Latest Posts
Article information

Author: Dean Jakubowski Ret

Last Updated:

Views: 6634

Rating: 5 / 5 (50 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Dean Jakubowski Ret

Birthday: 1996-05-10

Address: Apt. 425 4346 Santiago Islands, Shariside, AK 38830-1874

Phone: +96313309894162

Job: Legacy Sales Designer

Hobby: Baseball, Wood carving, Candle making, Jigsaw puzzles, Lacemaking, Parkour, Drawing

Introduction: My name is Dean Jakubowski Ret, I am a enthusiastic, friendly, homely, handsome, zealous, brainy, elegant person who loves writing and wants to share my knowledge and understanding with you.