Class IDComparer<T>
Class intended for comparing/hashing objects that implement IHasID. Type T must be a reference type.
Implements
Inherited Members
Namespace: SadRogue.Primitives.SpatialMaps
Assembly: TheSadRogue.Primitives.dll
Syntax
public class IDComparer<T> : IEqualityComparer<T> where T : class, IHasID
Type Parameters
| Name | Description |
|---|---|
| T | Type of object being compared. Type T must be a reference type that implements IHasID. |
Constructors
View SourceIDComparer()
Declaration
public IDComparer()
Methods
View SourceEquals(T?, T?)
Equality comparison. Performs comparison via the object's ReferenceEquals(object, object) function.
Declaration
public bool Equals(T? x, T? y)
Parameters
| Type | Name | Description |
|---|---|---|
| T | x | First object to compare. |
| T | y | Second object to compare. |
Returns
| Type | Description |
|---|---|
| bool | True if the objects are considered equal, false otherwise. |
GetHashCode(T)
Generates a hash based on the object's ID.GetHashCode() function.
Declaration
public int GetHashCode(T obj)
Parameters
| Type | Name | Description |
|---|---|---|
| T | obj | Object to generate the hash for. |
Returns
| Type | Description |
|---|---|
| int | The hash of the object, based on its ID. |