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

  • Home
  • SEARCH
  • 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 9107307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:32:24+00:00 2026-06-17T02:32:24+00:00

Will the value that comes out of long.GetHashCode() be reliably the same across different

  • 0

Will the value that comes out of long.GetHashCode() be reliably the same across different .NET Framework-versions, OS-versions, processor-architecture and so on?

The question is based on other questions that mentions different results on different servers.

// Will I be the same everywhere?
var hash = 2170881568869167279.GetHashCode();

Bonus: Does the same go for int and uint?

  • 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-06-17T02:32:25+00:00Added an answer on June 17, 2026 at 2:32 am

    Per the contract of GetHashCode, it is not even required to be the same on the same machine in two different processes:

    the default implementation of this method must not be used as a unique object identifier for hashing purposes.

    For certain types it could be – and probably is – implemented in a way that will always return the same hash code, even on different machines. But that is an implementation detail you should not rely on – it could change without notice.

    Furthermore, two different objects can legally have the same hash code. In your example with long, on average you will have each hashcode long.MaxValue / int.MaxValue times when you create the hashcode for all values from long.MinValue to long.Maxvalue.

    Conclusion:
    No, it is not a reliable way to identify an instance of an object.

    When dealing with numbers, you could simply use the number itself or use a real hashing algorithm.

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

Sidebar

Related Questions

What will the return value for performSelector: if I pass a selector that returns
I was looking at creating a TRIGGER that will set the value of a
Can I create an attribute that will let me modify the value of it
I'm working on an autocompletetextview that will work off of a key value system,
How do I declare that a symbol will always stand for a particular value
Say you construct an activerecord query that will always just return a single value,
When evaluating the value of myObject.myMember My guess is that javascript will try to
I'm creating a class that will have one public method, which returns a value
Is there a way to specify a value to the text_area method that will
I'm trying to figure out syntax that supports unboxing an integral type (short/int/long) to

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.