StepAttribute

Ecng.ComponentModel

Validates that a numeric value lies on a discrete grid defined by Base + n * Step.

継承元: ValidationAttribute

実装: IValidator

コンストラクター

StepAttribute
public StepAttribute(decimal step, decimal baseValue)
stepAttribute = StepAttribute(step, baseValue)

Creates new StepAttribute.

step
Positive step.
baseValue
Grid base (default 0).

プロパティ

BaseValue
public decimal BaseValue { get; }
value = stepAttribute.BaseValue

Grid base.

DisableNullCheck
public bool DisableNullCheck { get; set; }
value = stepAttribute.DisableNullCheck
stepAttribute.DisableNullCheck = value

Allow null values.

Step
public decimal Step { get; }
value = stepAttribute.Step

Grid step.

メソッド

IsValid
public override bool IsValid(object value)
result = stepAttribute.IsValid(value)

Validates the specified value by converting it and applying the custom validation.

value
The value to validate.

戻り値: True if the value is valid; otherwise, false.