You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
607 B
29 lines
607 B
using EC.Helper.RabbitFunc.Runtime;
|
|
|
|
namespace EC.Helper.RabbitFunc.Expressions;
|
|
|
|
public class ConstantExpression : Expression
|
|
{
|
|
internal ConstantExpression(object value)
|
|
: base(ExpressionType.Constant)
|
|
{
|
|
Value = value;
|
|
}
|
|
|
|
public object Value { get; }
|
|
|
|
public override Type Type => Value?.GetType();
|
|
|
|
public override object Eval(RuntimeContext context)
|
|
{
|
|
if (context == null)
|
|
throw new ArgumentNullException(nameof(context));
|
|
|
|
return Value;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return Value.ToString();
|
|
}
|
|
}
|