Table of Contents

Class ListComparer<TElement>

Namespace
Microsoft.EntityFrameworkCore.ChangeTracking
Assembly
Microsoft.EntityFrameworkCore.dll

A ValueComparer<T> for lists of primitive items. The list can be typed as IEnumerable<T>, but can only be used with instances that implement IList<T>.

public sealed class ListComparer<TElement> : ValueComparer<IEnumerable<TElement>>, IEqualityComparer, IEqualityComparer<object>, IEqualityComparer<IEnumerable<TElement>>

Type Parameters

TElement

The element type.

Inheritance
ListComparer<TElement>
Implements
Inherited Members
Extension Methods

Remarks

This comparer should be used for reference types and non-nullable value types. Use NullableValueTypeListComparer<TElement> for nullable value types.

See EF Core value comparers for more information and examples.

Constructors

ListComparer(ValueComparer)

Creates a new instance of the list comparer.

public ListComparer(ValueComparer elementComparer)

Parameters

elementComparer ValueComparer

The comparer to use for comparing elements.

Properties

ElementComparer

The comparer to use for comparing elements.

public ValueComparer ElementComparer { get; }

Property Value

ValueComparer