Class ValueComparer
This is internal API and is not intended for use by Linq To DB applications. It may change or be removed without further notice.
public abstract class ValueComparer : IEqualityComparer, IEqualityComparer<object>
- Inheritance
-
ValueComparer
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ValueComparer(LambdaExpression, LambdaExpression)
Creates a new ValueComparer with the given comparison.
protected ValueComparer(LambdaExpression equalsExpression, LambdaExpression hashCodeExpression)
Parameters
equalsExpressionLambdaExpressionThe comparison expression.
hashCodeExpressionLambdaExpressionThe associated hash code generator.
Properties
EqualsExpression
The comparison expression.
public virtual LambdaExpression EqualsExpression { get; }
Property Value
HashCodeExpression
The hash code expression.
public virtual LambdaExpression HashCodeExpression { get; }
Property Value
Type
The type.
public abstract Type Type { get; }
Property Value
Methods
CreateDefault(Type, bool)
Creates a default ValueComparer<T> for the given type.
public static ValueComparer CreateDefault(Type type, bool favorStructuralComparisons)
Parameters
typeTypeThe type.
favorStructuralComparisonsboolIf true, then IStructuralEquatable will be used if the type implements it. This is usually used when byte arrays act as keys.
Returns
Equals(object?, object?)
Compares the two instances to determine if they are equal.
public abstract bool Equals(object? x, object? y)
Parameters
Returns
ExtractEqualsBody(Expression, Expression)
Takes EqualsExpression and replaces the two parameters with the given expressions, returning the transformed body.
public virtual Expression ExtractEqualsBody(Expression leftExpression, Expression rightExpression)
Parameters
leftExpressionExpressionThe new left expression.
rightExpressionExpressionThe new right expression.
Returns
- Expression
The body of the lambda with left and right parameters replaced.
GetDefaultValueComparer(Type, bool)
public static ValueComparer GetDefaultValueComparer(Type type, bool favorStructuralComparisons)
Parameters
Returns
GetDefaultValueComparer<T>(bool)
public static ValueComparer<T> GetDefaultValueComparer<T>(bool favorStructuralComparisons)
Parameters
favorStructuralComparisonsbool
Returns
Type Parameters
T
GetHashCode(object?)
Returns the hash code for the given instance.
public abstract int GetHashCode(object? obj)
Parameters
objobjectThe instance.
Returns
- int
The hash code.