/// <summary>When overridden in a derived class, serves as a hash function for the specified object for hashing algorithms and data structures, such as a hash table.</summary> /// <returns>A hash code for the specified object.</returns> /// <param name="obj">The object for which to get a hash code.</param> /// <exception cref="T:System.ArgumentNullException">The type of <paramref name="obj" /> is a reference type and <paramref name="obj" /> is null.</exception> public int GetHashCode(TParent obj) { try { var val = valueProvider.GetValue(obj); return(valueRule.GetHashCode(val)); } catch (InvalidOperationException) { throw; } catch (Exception e) { throw new InvalidOperationException($"{nameof(GetHashCode)} raised an unexpected exception.", e); } }
/// <summary>When overridden in a derived class, serves as a hash function for the specified object for hashing algorithms and data structures, such as a hash table.</summary> /// <returns>A hash code for the specified object.</returns> /// <param name="obj">The object for which to get a hash code.</param> /// <exception cref="T:System.ArgumentNullException">The type of <paramref name="obj" /> is a reference type and <paramref name="obj" /> is null.</exception> public int GetHashCode(T obj) => wrapped.GetHashCode(obj);