Open sandboxFocus

Class RefEqualityComparer

An implementation of IEqualityComparer<T> for IRef that compares references based on RefComparison semantics.

Inheritance
RefEqualityComparer
Namespace: Metalama.Framework.Code.Comparers
Assembly: Metalama.Framework.dll
Syntax
public sealed class RefEqualityComparer : IEqualityComparer<IRef>, IRefEqualityComparer
Remarks

This comparer allows using IRef instances as keys in dictionaries or elements in hash sets. Use the appropriate static property to obtain a comparer with the desired comparison strategy:

Properties

Name Description
Default

Gets the default equality comparer that uses Default semantics. This is the fastest comparer and is suitable for comparing references within the same compilation.

IncludeNullability

Gets an equality comparer that uses IncludeNullability semantics. Use when nullable reference type annotations should affect equality.

Structural

Gets an equality comparer that uses Structural semantics. Use when comparing references across different compilation versions.

StructuralIncludeNullability

Gets an equality comparer that uses StructuralIncludeNullability semantics. Use when comparing references across different compilations and nullable annotations matter.

Methods

Name Description
Equals(IRef?, IRef?)
GetHashCode(IRef)

Extension Methods

See Also