Table of Contents

Class ExpressionComparer

Namespace
Utils.Mathematics.Expressions
Assembly
Utils.dll

Provides a custom equality comparer for Expression objects. The comparison involves simplifying each expression via an ExpressionSimplifier before checking for structural and semantic equivalence.

public class ExpressionComparer : IEqualityComparer<Expression>
Inheritance
ExpressionComparer
Implements
Inherited Members
Extension Methods

Properties

Default

Gets the default ExpressionComparer instance for global usage.

public static ExpressionComparer Default { get; }

Property Value

ExpressionComparer

Methods

Equals(Expression?, Expression?)

Determines whether two Expression objects are equal by simplifying and comparing them structurally.

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

Parameters

x Expression

The first expression to compare.

y Expression

The second expression to compare.

Returns

bool

true if both expressions are considered equivalent after simplification; otherwise false.

GetHashCode(Expression)

Returns a hash code for the specified Expression by simplifying it and taking the hash code of its string representation.

public int GetHashCode(Expression obj)

Parameters

obj Expression

The Expression for which to get a hash code.

Returns

int

An integer hash code based on the simplified expression's string representation.