ValidateMaxValue

Description: Indicates a property has a maximum value.

Constructor(s):
  • public ValidateMaxValueAttribute(double maxValue, string message)

Parameters:
  • maxValue: The maximum value of the property.
  • message: The message to be used if validation fails.

Example Usage:
public class MyEntity : EvilBaseEntity
{
    [ValidateMaxValue(100, "Property1 is has a maximum value of 100.")]
    public double Property1
    {
        // Omitted for brevity
    }
}


Valid Entity 1:
MyEntity entity = new MyEntity();
entity.Property1 = 100;

bool result = entity.IsValid();


Valid Entity 2:
MyEntity entity = new MyEntity();
entity.Property1 = 99.99999;

bool result = entity.IsValid();


Invalid Entity:
MyEntity entity = new MyEntity();
entity.Property1 = 100.0000001;

bool result = entity.IsValid();

Last edited Dec 7, 2006 at 2:44 PM by Arcware, version 1

Comments

No comments yet.