Class ParsedExpression<TArg, TResult>
- Namespace
- LfrlAnvil.Computable.Expressions
- Assembly
- LfrlAnvil.Computable.Expressions.dll
Represents a parsed expression.
public sealed class ParsedExpression<TArg, TResult> : IParsedExpression<TArg, TResult>
Type Parameters
TArg
Argument type.
TResult
Result type.
- Inheritance
-
ParsedExpression<TArg, TResult>
- Implements
-
IParsedExpression<TArg, TResult>
- Inherited Members
Properties
Body
Body node of this expression.
public Expression Body { get; }
Property Value
BoundArguments
Collection of bound arguments.
public ParsedExpressionBoundArguments<TArg> BoundArguments { get; }
Property Value
DiscardedArguments
Collection of discarded arguments.
public ParsedExpressionDiscardedArguments DiscardedArguments { get; }
Property Value
Input
Original input that created this expression.
public string Input { get; }
Property Value
Parameter
Parameter node of this expression.
public ParameterExpression Parameter { get; }
Property Value
UnboundArguments
Collection of named unbound arguments. Values for those arguments must be provided during delegate invocation.
public ParsedExpressionUnboundArguments UnboundArguments { get; }
Property Value
Methods
BindArguments(IEnumerable<KeyValuePair<StringSegment, TArg?>>)
Creates a new IParsedExpression<TArg, TResult> instance with bound arguments.
[Pure]
public ParsedExpression<TArg, TResult> BindArguments(IEnumerable<KeyValuePair<StringSegment, TArg?>> arguments)
Parameters
arguments
IEnumerable<KeyValuePair<StringSegment, TArg>>Collection of arguments to bind.
Returns
- ParsedExpression<TArg, TResult>
New IParsedExpression<TArg, TResult> instance.
Exceptions
- ParsedExpressionArgumentBindingException
When an unbound argument does not exist.
- ParsedExpressionCreationException
When expression could not be parsed.
BindArguments(IEnumerable<KeyValuePair<int, TArg?>>)
Creates a new IParsedExpression<TArg, TResult> instance with bound arguments.
[Pure]
public ParsedExpression<TArg, TResult> BindArguments(IEnumerable<KeyValuePair<int, TArg?>> arguments)
Parameters
arguments
IEnumerable<KeyValuePair<int, TArg>>Collection of arguments to bind.
Returns
- ParsedExpression<TArg, TResult>
New IParsedExpression<TArg, TResult> instance.
Exceptions
- IndexOutOfRangeException
When an argument index is invalid.
- ParsedExpressionCreationException
When expression could not be parsed.
BindArguments(IEnumerable<KeyValuePair<string, TArg?>>)
Creates a new IParsedExpression<TArg, TResult> instance with bound arguments.
[Pure]
public ParsedExpression<TArg, TResult> BindArguments(IEnumerable<KeyValuePair<string, TArg?>> arguments)
Parameters
arguments
IEnumerable<KeyValuePair<string, TArg>>Collection of arguments to bind.
Returns
- ParsedExpression<TArg, TResult>
New IParsedExpression<TArg, TResult> instance.
Exceptions
- ParsedExpressionArgumentBindingException
When an unbound argument does not exist.
- ParsedExpressionCreationException
When expression could not be parsed.
BindArguments(params KeyValuePair<StringSegment, TArg?>[])
Creates a new IParsedExpression<TArg, TResult> instance with bound arguments.
[Pure]
public ParsedExpression<TArg, TResult> BindArguments(params KeyValuePair<StringSegment, TArg?>[] arguments)
Parameters
arguments
KeyValuePair<StringSegment, TArg>[]Collection of arguments to bind.
Returns
- ParsedExpression<TArg, TResult>
New IParsedExpression<TArg, TResult> instance.
Exceptions
- ParsedExpressionArgumentBindingException
When an unbound argument does not exist.
- ParsedExpressionCreationException
When expression could not be parsed.
BindArguments(params KeyValuePair<int, TArg?>[])
Creates a new IParsedExpression<TArg, TResult> instance with bound arguments.
[Pure]
public ParsedExpression<TArg, TResult> BindArguments(params KeyValuePair<int, TArg?>[] arguments)
Parameters
arguments
KeyValuePair<int, TArg>[]Collection of arguments to bind.
Returns
- ParsedExpression<TArg, TResult>
New IParsedExpression<TArg, TResult> instance.
Exceptions
- IndexOutOfRangeException
When an argument index is invalid.
- ParsedExpressionCreationException
When expression could not be parsed.
BindArguments(params KeyValuePair<string, TArg?>[])
Creates a new IParsedExpression<TArg, TResult> instance with bound arguments.
[Pure]
public ParsedExpression<TArg, TResult> BindArguments(params KeyValuePair<string, TArg?>[] arguments)
Parameters
arguments
KeyValuePair<string, TArg>[]Collection of arguments to bind.
Returns
- ParsedExpression<TArg, TResult>
New IParsedExpression<TArg, TResult> instance.
Exceptions
- ParsedExpressionArgumentBindingException
When an unbound argument does not exist.
- ParsedExpressionCreationException
When expression could not be parsed.
Compile()
Compiles this expression.
[Pure]
public ParsedExpressionDelegate<TArg, TResult> Compile()
Returns
- ParsedExpressionDelegate<TArg, TResult>
New IParsedExpressionDelegate<TArg, TResult> instance.
ToString()
Returns a string representation of this ParsedExpression<TArg, TResult> instance.
[Pure]
public override string ToString()
Returns
- string
String representation.