RangeAttribute Constructor (Int32, Int32)

Initializes a new instance of the RangeAttribute class with specified integer values as the minimum and maximum limits.

Namespace:  System.ComponentModel.DataAnnotations
Assembly:  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)

public RangeAttribute(
	int minimum,
	int maximum
)

Parameters

minimum
Type: System.Int32
The minimum value.
maximum
Type: System.Int32
The maximum value.

The following example shows how to specify integer range values for one property and decimal range values for another property.


public class Product
{

  [Range(5, 50)]
  public int ReorderLevel { get; set; }

  [Range(typeof(Decimal),"5", "5000")]
  public decimal ListPrice { get; set; }

}


Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show: