Share via


KeyComparer Class

Definition

An implementation of IComparer<T> and IEqualityComparer<T> to compare IReadOnlyKey instances.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

public sealed class KeyComparer : System.Collections.Generic.IComparer<Microsoft.EntityFrameworkCore.Metadata.IKey>, System.Collections.Generic.IEqualityComparer<Microsoft.EntityFrameworkCore.Metadata.IKey>
public sealed class KeyComparer : System.Collections.Generic.IComparer<Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey>, System.Collections.Generic.IEqualityComparer<Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey>
type KeyComparer = class
    interface IEqualityComparer<IKey>
    interface IComparer<IKey>
type KeyComparer = class
    interface IEqualityComparer<IReadOnlyKey>
    interface IComparer<IReadOnlyKey>
Public NotInheritable Class KeyComparer
Implements IComparer(Of IKey), IEqualityComparer(Of IKey)
Public NotInheritable Class KeyComparer
Implements IComparer(Of IReadOnlyKey), IEqualityComparer(Of IReadOnlyKey)
Inheritance
KeyComparer
Implements

Remarks

See Implementation of database providers and extensions for more information and examples.

Fields

Instance

The singleton instance of the comparer to use.

Methods

Compare(IKey, IKey)

Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.

Compare(IReadOnlyKey, IReadOnlyKey)

Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.

Equals(IKey, IKey)

Determines whether the specified objects are equal.

Equals(IReadOnlyKey, IReadOnlyKey)

Determines whether the specified objects are equal.

GetHashCode(IKey)

Returns a hash code for the specified object.

GetHashCode(IReadOnlyKey)

Returns a hash code for the specified object.

Applies to