Class ParsedExpressionBufferedDelegate<TArg, TResult>
- Namespace
- LfrlAnvil.Computable.Expressions
- Assembly
- LfrlAnvil.Computable.Expressions.dll
Represents a compiled parsed expression with its own argument values buffer.
public sealed class ParsedExpressionBufferedDelegate<TArg, TResult>
Type Parameters
TArg
Argument type.
TResult
Result type.
- Inheritance
-
ParsedExpressionBufferedDelegate<TArg, TResult>
- Inherited Members
Properties
Base
Underlying delegate.
public IParsedExpressionDelegate<TArg, TResult> Base { get; }
Property Value
- IParsedExpressionDelegate<TArg, TResult>
Methods
ClearArgumentValues(TArg?)
Resets all buffered argument values.
public ParsedExpressionBufferedDelegate<TArg, TResult> ClearArgumentValues(TArg? defaultValue = default)
Parameters
defaultValue
TArgOptional argument value.
Returns
- ParsedExpressionBufferedDelegate<TArg, TResult>
this.
GetArgumentValue(StringSegment)
Gets the value for a named argument.
[Pure]
public TArg? GetArgumentValue(StringSegment argumentName)
Parameters
argumentName
StringSegmentArgument name.
Returns
- TArg
Current value assigned to the argument.
Exceptions
- InvalidParsedExpressionArgumentsException
When argument with the provided name does not exist.
GetArgumentValue(int)
Gets the value for an argument at the specified 0-based position.
[Pure]
public TArg? GetArgumentValue(int index)
Parameters
index
int0-based position of an argument.
Returns
- TArg
Current value assigned to the argument.
Exceptions
- IndexOutOfRangeException
When
index
is not valid.
Invoke()
Invokes this delegate with buffered argument values.
[Pure]
public TResult Invoke()
Returns
- TResult
Invocation result.
SetArgumentValue(StringSegment, TArg?)
Sets the value for a named argument.
public ParsedExpressionBufferedDelegate<TArg, TResult> SetArgumentValue(StringSegment argumentName, TArg? value)
Parameters
argumentName
StringSegmentArgument name.
value
TArgValue to set.
Returns
- ParsedExpressionBufferedDelegate<TArg, TResult>
this.
Exceptions
- InvalidParsedExpressionArgumentsException
When argument with the provided name does not exist.
SetArgumentValue(int, TArg?)
Sets the value for an argument at the specified 0-based position.
public ParsedExpressionBufferedDelegate<TArg, TResult> SetArgumentValue(int index, TArg? value)
Parameters
index
int0-based position of an argument.
value
TArgValue to set.
Returns
- ParsedExpressionBufferedDelegate<TArg, TResult>
this.
Exceptions
- IndexOutOfRangeException
When
index
is not valid.