Class ExpressionTypeAllowListScannerBase
Base class for expression visitors used to check uses of type members against a list of allowed types.
Namespace: System.Linq.CompilerServices
Assembly: Nuqleon.Linq.CompilerServices.dll
Syntax
public abstract class ExpressionTypeAllowListScannerBase : ExpressionVisitor
Constructors
ExpressionTypeAllowListScannerBase()
Declaration
protected ExpressionTypeAllowListScannerBase()
Methods
Check(Type)
Checks whether the specified type is supported.
Declaration
protected abstract bool Check(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | Type to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if the type is supported; otherwise, false. |
ResolveExpression<T>(T, Type, Func<T, Expression>)
Resolves an expression whose type was rejected by the checker.
Declaration
protected virtual Expression ResolveExpression<T>(T expression, Type type, Func<T, Expression> visit)
where T : Expression
Parameters
Type | Name | Description |
---|---|---|
T | expression | Expression to resolve. |
System.Type | type | Type that was rejected. |
System.Func<T, System.Linq.Expressions.Expression> | visit | Function to continue the visit of the node. |
Returns
Type | Description |
---|---|
System.Linq.Expressions.Expression | Resolved expression, or an exception. By default, the method throws a NotSupportedException. |
Type Parameters
Name | Description |
---|---|
T | Type the expression to resolve. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | The specified expression was rejected. |
Visit(Expression)
Checks whether the expression's type is on the list of allowed types.
Declaration
public override Expression Visit(Expression node)
Parameters
Type | Name | Description |
---|---|---|
System.Linq.Expressions.Expression | node | Node to check. |
Returns
Type | Description |
---|---|
System.Linq.Expressions.Expression | The original node if the expression was accepted by the checker; otherwise, a rewritten result or an exception. |