Struct HashCode
A hash code used to help with implementing GetHashCode().
This code is from the blog post at https://rehansaeed.com/gethashcode-made-easy/
Implements
Inherited Members
Namespace: Material.Blazor
Assembly: Material.Blazor.dll
Syntax
public struct HashCode : IEquatable<HashCode>
Constructors
| Improve this Doc View SourceHashCode(Int32)
Initializes a new instance of the HashCode struct.
Declaration
public HashCode(int value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | The value. |
Fields
| Improve this Doc View Sourcevalue
Declaration
public readonly int value
Field Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceAnd<T>(T)
Adds the hash code of the specified item.
Declaration
public HashCode And<T>(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item. |
Returns
Type | Description |
---|---|
HashCode | The new hash code. |
Type Parameters
Name | Description |
---|---|
T | The type of the item. |
AndEach<T>(IEnumerable<T>)
Adds the hash code of the specified items in the collection.
Declaration
public HashCode AndEach<T>(IEnumerable<T> items)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | items | The collection. |
Returns
Type | Description |
---|---|
HashCode | The new hash code. |
Type Parameters
Name | Description |
---|---|
T | The type of the items. |
CombineHashCodes(Int32, Int32)
Declaration
public static int CombineHashCodes(int h1, int h2)
Parameters
Type | Name | Description |
---|---|---|
Int32 | h1 | |
Int32 | h2 |
Returns
Type | Description |
---|---|
Int32 |
Equals(HashCode)
Declaration
public bool Equals(HashCode other)
Parameters
Type | Name | Description |
---|---|---|
HashCode | other |
Returns
Type | Description |
---|---|
Boolean |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
| Improve this Doc View SourceOf<T>(T)
Takes the hash code of the specified item.
Declaration
public static HashCode Of<T>(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item. |
Returns
Type | Description |
---|---|
HashCode | The new hash code. |
Type Parameters
Name | Description |
---|---|
T | The type of the item. |
OfEach<T>(IEnumerable<T>)
Takes the hash code of the specified items.
Declaration
public static HashCode OfEach<T>(IEnumerable<T> items)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | items | The collection. |
Returns
Type | Description |
---|---|
HashCode | The new hash code. |
Type Parameters
Name | Description |
---|---|
T | The type of the items. |
Operators
| Improve this Doc View SourceEquality(HashCode, HashCode)
Implements the operator ==.
Declaration
public static bool operator ==(HashCode left, HashCode right)
Parameters
Type | Name | Description |
---|---|---|
HashCode | left | The left. |
HashCode | right | The right. |
Returns
Type | Description |
---|---|
Boolean | The result of the operator. |
Implicit(HashCode to Int32)
Declaration
public static implicit operator int (HashCode hashCode)
Parameters
Type | Name | Description |
---|---|---|
HashCode | hashCode | The hash code. |
Returns
Type | Description |
---|---|
Int32 | The result of the conversion. |
Inequality(HashCode, HashCode)
Implements the operator !=.
Declaration
public static bool operator !=(HashCode left, HashCode right)
Parameters
Type | Name | Description |
---|---|---|
HashCode | left | The left. |
HashCode | right | The right. |
Returns
Type | Description |
---|---|
Boolean | The result of the operator. |