Table of Contents

Class ForeignKeyComparer

Namespace
Microsoft.EntityFrameworkCore.Metadata
Assembly
Microsoft.EntityFrameworkCore.dll

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

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

public sealed class ForeignKeyComparer : IEqualityComparer<IReadOnlyForeignKey>, IComparer<IReadOnlyForeignKey>
Inheritance
ForeignKeyComparer
Implements
Inherited Members

Remarks

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

Fields

Instance

The singleton instance of the comparer to use.

public static readonly ForeignKeyComparer Instance

Field Value

ForeignKeyComparer

Methods

Compare(IReadOnlyForeignKey?, IReadOnlyForeignKey?)

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

public int Compare(IReadOnlyForeignKey? x, IReadOnlyForeignKey? y)

Parameters

x IReadOnlyForeignKey

The first object to compare.

y IReadOnlyForeignKey

The second object to compare.

Returns

int

A negative number if 'x' is less than 'y'; a positive number if 'x' is greater than 'y'; zero otherwise.

Equals(IReadOnlyForeignKey?, IReadOnlyForeignKey?)

Determines whether the specified objects are equal.

public bool Equals(IReadOnlyForeignKey? x, IReadOnlyForeignKey? y)

Parameters

x IReadOnlyForeignKey

The first object to compare.

y IReadOnlyForeignKey

The second object to compare.

Returns

bool

true if the specified objects are equal; otherwise, false.

GetHashCode(IReadOnlyForeignKey)

Returns a hash code for the specified object.

public int GetHashCode(IReadOnlyForeignKey obj)

Parameters

obj IReadOnlyForeignKey

The for which a hash code is to be returned.

Returns

int

A hash code for the specified object.