I am a bit confused about calling HashCode.Combine
in a non generic way
HashCode
has public void Add<T> (T value);
but not public void Add (object value);
In my case I need to calculate the combined hashcode of an unknown number of objects of unknown types.
Is it OK to do:
object v1 = ...
object v2 = ...
object v3 = ...
var hashCodeStruct = new HashCode();
hashCodeStruct.Add(v1);
hashCodeStruct.Add(v2);
hashCodeStruct.Add(v3);
var hashCode = hashCodeStruct.ToHashCode();
?