Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1928224
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:57:09+00:00 2026-05-17T06:57:09+00:00

My understanding of these three was: .Equals() tests for data equality (for the lack

  • 0

My understanding of these three was:

  • .Equals() tests for data equality (for the lack of a better description). .Equals() can return True for different instances of the same object, and this is the most commonly overridden method.

  • .ReferenceEquals() tests whether or not two objects are the same instance and cannot be overridden.

  • == is the same as the ReferenceEquals() by default, but this CAN be overridden.

But C# station states:

In the object class, the Equals and
ReferenceEquals methods are
semantically equivalent, except that
the ReferenceEquals works only on
object instances. The
ReferenceEquals method is static.

Now I don’t get it. Can anyone shed some light on this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T06:57:09+00:00Added an answer on May 17, 2026 at 6:57 am

    The source of your confusion appears to be that there is a typo in the extract from C# station, which should read: “… except that the Equals works only on object instances. The ReferenceEquals method is static.”


    You are loosely correct about the differences in the semantic meanings of each (although “different instances of the same object” seems a little confused, it should probably read “different instances of the same type) and about which can be overridden.

    If we leave that aside, let’s deal with the last bit of your question, i.e. how they work with plainSystem.Objectinstances and System.Objectreferences (we need both to dodge the non-polymorphic nature of ==). Here, all three operations will work equivalentally, but with a caveat:Equalscannot be invoked onnull.

    Equalsis an instance method that takes one parameter (which can benull). Since it is an instance method (must be invoked on an actual object), it can’t be invoked on a null-reference.

    ReferenceEquals is a static method that takes two parameters, either / both of which can be null. Since it is static (not associated with an object instance), it will not throw aNullReferenceException under any circumstances.

    ==is an operator, that, in this case (object), behaves identically to ReferenceEquals. It will not throw aNullReferenceExceptioneither.

    To illustrate:

    object o1 = null;
    object o2 = new object();
    
    //Technically, these should read object.ReferenceEquals for clarity, but this is redundant.
    ReferenceEquals(o1, o1); //true
    ReferenceEquals(o1, o2); //false
    ReferenceEquals(o2, o1); //false
    ReferenceEquals(o2, o2); //true
    
    o1.Equals(o1); //NullReferenceException
    o1.Equals(o2); //NullReferenceException
    o2.Equals(o1); //false
    o2.Equals(o2); //true
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

It's my understanding that all three of these lines below should return an ARRAY
I am rather confused with the purpose of these three files. If my understanding
I am really confused about these three terms. My understanding is that: in the
From my understanding, each of these methods: get() and put() are atomic. But, when
I am really struggling with understanding the difference between these two. From my textbook,
I know there are three different, popular types of non-sql databases. Key/Value: Redis, Tokyo
There's something I'm not quite understanding about the use of boilerpipe's ArticleExtractor class. Albeit,
I've read this answer about eight-five times, but there's something I'm not understanding correctly:
Understanding Magento Models by reference of SQL: select * from user_devices where user_id =
Understanding that I should probably just dig into the source to come up with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.