I need to build a stable (= does not vary with time) hashcode of an object. Specifically, I do not know the exact type of the object. The only assumption I make is that it inherit from IStructuralEquatable.
So I need a method:
static string GetStableHashcode <T> (T object) where T: IStructuralEquatable
The .Net framework provide this type of function? Otherwise, which algorithm to use?
Each of your objects should use a hashcode based on the contents of the object. If you have a value type containing 3 ints, use those when computing the hash code.
Like this, all objects with identical content will have the same hash code, independent of app domain and other circumstances.
An example for a good hash code can be found in this answer.