/// <summary> /// Returns a hash code for this instance. /// </summary> /// <param name="obj">The object.</param> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public static int GetHashCode(IBinaryObject obj) { if (obj == null) return 0; var binObj = GetBinaryObject(obj); var arg = new KeyValuePair<int, int>(GetDataStart(binObj), GetDataLength(binObj)); using (var stream = new BinaryHeapStream(binObj.Data)) { return stream.Apply(HashCodeProcessor, arg); } }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <param name="obj">The object.</param> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public int GetHashCode(IBinaryObject obj) { if (obj == null) { return(0); } var binObj = GetBinaryObject(obj); var arg = new KeyValuePair <int, int>(GetDataStart(binObj), GetDataLength(binObj)); using (var stream = new BinaryHeapStream(binObj.Data)) { return(stream.Apply(this, arg)); } }