Table of Contents

Class ConstantNumericAttribute

Namespace
Utils.Expressions
Assembly
Utils.dll

A specialized attribute that indicates the expected parameter is a ConstantExpression holding a numeric value, optionally restricted to a specific set of allowed numeric values.

[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
public class ConstantNumericAttribute : ExpressionSignatureAttribute
Inheritance
ConstantNumericAttribute
Inherited Members
Extension Methods

Constructors

ConstantNumericAttribute()

Creates a new instance allowing any numeric constant.

public ConstantNumericAttribute()

ConstantNumericAttribute(params double[])

Creates a new instance allowing only the specified numeric values.

public ConstantNumericAttribute(params double[] values)

Parameters

values double[]

The allowed numeric values.

Properties

Values

The allowed numeric values, if any. If null, any numeric constant is allowed.

public IReadOnlyList<double>? Values { get; }

Property Value

IReadOnlyList<double>

Methods

Match(Expression)

Indicates whether the given expression matches the requirements of this attribute. The default implementation checks ExpressionType or allows any if set to -1.

public override bool Match(Expression e)

Parameters

e Expression

The expression to match.

Returns

bool

True if it matches; otherwise false.