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 3500622
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:45:25+00:00 2026-05-18T12:45:25+00:00

Is there a C# equivalent to Python’s id() ? If not, how can I

  • 0

Is there a C# equivalent to Python’s id()? If not, how can I test if an object has changed? For example, in Python, an immutable object:

>>> s = "abc"
>>> id(s)
11172320
>>> s += "d"
>>> id(s)
18632928

and a mutable one:

>>> a = [1, 2, 3]
>>> id(a)
11259656
>>> a += [4]
>>> id(a)
11259656

Edit – Most of the answers so far are about comparison functions/operators but I’m more interested in the values that are being compared. I wasn’t initially clear about that, and I’m accepting Object.ReferenceEquals as the answer.

  • 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-18T12:45:25+00:00Added an answer on May 18, 2026 at 12:45 pm

    Well, you can use the Object.ReferenceEquals() function:

    Determines whether the specified Object instances are the same instance.

    To borrow your Python example a little bit:

    List<int> listA = new List<int> { 1, 2, 3 };
    List<int> listB = listA;
    listA.Add(4);
    
    bool equal = object.ReferenceEquals(listA, listB);
    

    equal will be true.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any Ruby equivalent for Python's builtin zip function? If not, what is
Is there an equivalent of slime for python? For example, if I position the
Is there a Ruby equivalent for Python's is? It tests whether two objects are
Is there some equivalent of friend or internal in php? If not, is there
Is there an equivalent in Python for PHP's call_user_func_array ?
Is there C++ equivalent for python Xrange generator in either STL or boost? xrange
Is there an equivalent to Python's popen2 in Java?
Is there a Python equivalent to Ruby symbols? If so then what is it?
Is there a .net equivalent for urllib I used in Python? I've seen WebRequest
Is there any such equivalent of Java String myMethod (MyClass argument) {...} in Python?

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.