IntegerValidatorAttribute 构造函数  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
创建 IntegerValidatorAttribute 类的新实例。
public:
 IntegerValidatorAttribute();public IntegerValidatorAttribute ();Public Sub New ()示例
下面的示例演示如何使用 IntegerValidatorAttribute 构造函数。
[ConfigurationProperty("maxSize", DefaultValue = 1000,
    IsRequired = true)]
[IntegerValidator()]
public int MaxSize
{
    get
    {
        return (int)this["maxSize"];
    }
    set
    {
        this["maxSize"] = value;
    }
}
<ConfigurationProperty("maxSize", _
DefaultValue:=1000, _
IsRequired:=True), _
IntegerValidator()> _
Public Property MaxSize() As Integer
    Get
        Return Fix(Me("maxSize"))
    End Get
    Set(ByVal value As Integer)
        Me("maxSize") = value
    End Set
End Property
注解
在特性化模型中使用此构造函数,以确保分配给相关属性的值是整数。