Possible Duplicate:
How does Object.GetHashCode work when the GC moves an object?
The garbage collector in .NET moves objects, so the object's address is not stable. How is Object's GetHashCode() method implemented?
Thanks!
Possible Duplicate:
How does Object.GetHashCode work when the GC moves an object?
The garbage collector in .NET moves objects, so the object's address is not stable. How is Object's GetHashCode() method implemented?
Thanks!
The garbage collector assigns with each object an unique ID, and this is what the default GetHashCode implementation uses instead of the memory location.
Edit It's a bit more complex than that actually. Not want to mislead anyone, so you guys should prefer Jon Skeet's answer on the topic.