int i = 1;
int j = 1;
System.Console.WriteLine(i == j);
System.Console.WriteLine(i.ToString() == j.ToString());
System.Console.WriteLine((object)i == (object)j);
Give the sample code above, what is the output to the console?

Answer Posted / sahdev singh

True - First time we are comparing only values.
True - Second time also we are comparing only values.
False - We are comparing reference of two objects.

Is This Answer Correct ?    9 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How long does it take to learn c# for unity?

559


What is difference between singleordefault and firstordefault?

580


How can we make a thread sleep for infinite period ?

628


How many types of delegates are there in c#?

550


What is the difference between string and string in c#?

569






Can a class have more than 1 destructor?

609


What is the difference between CreateObject() and GetObject()?

632


What is the c# equivalent of c++ catch (...), Which was a catch-all statement for any possible exception?

602


What is difference between mutable and immutable in c#?

532


What is concrete class in c#?

553


What are the steps to create a webservice and consume it?

546


What is a event in c#?

539


In which order the constructor is called for an inherited class?

626


Does google use c#?

606


How to implement singleton design pattern in c#?

552