Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

struct System.​HashCode

Assembly: System.Runtime

Combines the hash code for multiple values into a single hash code.

Methods

public void
AddBytes​(ReadOnlySpan<​byte> value)
Adds a span of bytes to the hash code.
value The span to add.
public void
Add​(T value)
Adds a single value to the hash code.
value The value to add to the hash code.
public void
Add​(T value, IEqualityComparer?<​T> comparer)
Adds a single value to the hash code, specifying the type that provides the hash code function.
value The value to add to the hash code.
comparer The <see cref="T:System.Collections.Generic.IEqualityComparer`1" /> to use to calculate the hash code. This value can be a null reference (Nothing in Visual Basic), which will use the default equality comparer for <typeparamref name="T" /> .
public static int
Combine​(T1 value1)
Diffuses the hash code returned by the specified value.
Returns The hash code that represents the single value.
value1 The value to add to the hash code.
public static int
Combine​(T1 value1, T2 value2)
Combines two values into a hash code.
Returns The hash code that represents the two values.
value1 The first value to combine into the hash code.
value2 The second value to combine into the hash code.
public static int
Combine​(T1 value1, T2 value2, T3 value3)
Combines three values into a hash code.
Returns The hash code that represents the three values.
value1 The first value to combine into the hash code.
value2 The second value to combine into the hash code.
value3 The third value to combine into the hash code.
public static int
Combine​(T1 value1, T2 value2, T3 value3, T4 value4)
Combines four values into a hash code.
Returns The hash code that represents the four values.
value1 The first value to combine into the hash code.
value2 The second value to combine into the hash code.
value3 The third value to combine into the hash code.
value4 The fourth value to combine into the hash code.
public static int
Combine​(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5)
Combines five values into a hash code.
Returns The hash code that represents the five values.
value1 The first value to combine into the hash code.
value2 The second value to combine into the hash code.
value3 The third value to combine into the hash code.
value4 The fourth value to combine into the hash code.
value5 The fifth value to combine into the hash code.
public static int
Combine​(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6)
Combines six values into a hash code.
Returns The hash code that represents the six values.
value1 The first value to combine into the hash code.
value2 The second value to combine into the hash code.
value3 The third value to combine into the hash code.
value4 The fourth value to combine into the hash code.
value5 The fifth value to combine into the hash code.
value6 The sixth value to combine into the hash code.
public static int
Combine​(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7)
Combines seven values into a hash code.
Returns The hash code that represents the seven values.
value1 The first value to combine into the hash code.
value2 The second value to combine into the hash code.
value3 The third value to combine into the hash code.
value4 The fourth value to combine into the hash code.
value5 The fifth value to combine into the hash code.
value6 The sixth value to combine into the hash code.
value7 The seventh value to combine into the hash code.
public static int
Combine​(T1 value1, T2 value2, T3 value3, T4 value4, T5 value5, T6 value6, T7 value7, T8 value8)
Combines eight values into a hash code.
Returns The hash code that represents the eight values.
value1 The first value to combine into the hash code.
value2 The second value to combine into the hash code.
value3 The third value to combine into the hash code.
value4 The fourth value to combine into the hash code.
value5 The fifth value to combine into the hash code.
value6 The sixth value to combine into the hash code.
value7 The seventh value to combine into the hash code.
value8 The eighth value to combine into the hash code.
public bool
Equals​(object obj)
This method is not supported and should not be called.
Returns This method will always throw a <see cref="T:System.NotSupportedException" /> .
obj Ignored.
public int
GetHashCode​()
This method is not supported and should not be called.
Returns This method will always throw a <see cref="T:System.NotSupportedException" /> .
public int
ToHashCode​()
Calculates the final hash code after consecutive <see cref="Overload:System.HashCode.Add" /> invocations.
Returns The calculated hash code.
public string
ToString​()
Inherited from ValueType
Returns the fully qualified type name of this instance.
Returns The fully qualified type name.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .