Class ExpressionInterning
Static helper class for expression interning with default cache.
Inheritance
Namespace: System.Linq.Expressions
Assembly: Nuqleon.Linq.CompilerServices.dll
Syntax
public static class ExpressionInterning : Object
Methods
ClearInternCache()
Clears the static interning cache used by the Intern extension method.
Declaration
public static void ClearInternCache()
Intern<TExpression>(TExpression)
Rewrites the expression tree using pre-existing cached nodes.
Declaration
public static TExpression Intern<TExpression>(this TExpression expression)
where TExpression : Expression
Parameters
| Type | Name | Description |
|---|---|---|
| TExpression | expression | The expression to rewrite. |
Returns
| Type | Description |
|---|---|
| TExpression | The expression with nodes replaced by potentially pre-cached expression values. |
Type Parameters
| Name | Description |
|---|---|
| TExpression | The type of expression to rewrite. |
Remarks
This extension method uses a static default cache with a default expression equality comparer. For more control over equality checks for expressions, construct a new instance of the
ExpressionInterningCache.
Intern<TExpression>(TExpression, IExpressionInterningCache)
Rewrites the expression tree using pre-existing cached nodes.
Declaration
public static TExpression Intern<TExpression>(this TExpression expression, IExpressionInterningCache cache)
where TExpression : Expression
Parameters
| Type | Name | Description |
|---|---|---|
| TExpression | expression | The expression to rewrite. |
| IExpressionInterningCache | cache | The expression cache to use for the rewrite. |
Returns
| Type | Description |
|---|---|
| TExpression | The expression with nodes replaced by potentially pre-cached expression values. |
Type Parameters
| Name | Description |
|---|---|
| TExpression | The type of expression to rewrite. |