Skip to content

Commit a6f0c4e

Browse files
committed
Useful additional generic method EvaluateArg in FunctionEvaluationEventArg
1 parent 120e659 commit a6f0c4e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

CodingSeb.ExpressionEvaluator/ExpressionEvaluator.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2739,6 +2739,17 @@ public object EvaluateArg(int index)
27392739
return evaluateFunc(Args[index]);
27402740
}
27412741

2742+
/// <summary>
2743+
/// Get the value of the function's arg at the specified index
2744+
/// </summary>
2745+
/// <typeparam name="T">The type of the result to get. (Do a cast)</typeparam>
2746+
/// <param name="index">The index of the function's arg to evaluate</param>
2747+
/// <returns>The evaluated arg casted in the specified type</returns>
2748+
public object EvaluateArg<T>(int index)
2749+
{
2750+
return (T)evaluateFunc(Args[index]);
2751+
}
2752+
27422753
/// <summary>
27432754
/// The name of the variable to Evaluate
27442755
/// </summary>

0 commit comments

Comments
 (0)