LongValidatorAttribute.ExcludeRange 属性

定义

获取或设置一个值,指示在 MinValueMaxValue 属性值定义的范围内是包含还是排除整数。Gets or sets a value that indicates whether to include or exclude the integers in the range defined by the MinValue and MaxValue property values.

public:
 property bool ExcludeRange { bool get(); void set(bool value); };
public bool ExcludeRange { get; set; }
member this.ExcludeRange : bool with get, set
Public Property ExcludeRange As Boolean

属性值

Boolean

如果必须排除值,则为 true;否则为 falsetrue if the value must be excluded; otherwise, false. 默认值为 falseThe default is false.

示例

下面的示例演示如何使用 ExcludeRange 属性。The following example shows how to use the ExcludeRange property.

[ConfigurationProperty("maxUsers", DefaultValue = (long)10000,
    IsRequired = false)]
[LongValidator(MinValue = 1, MaxValue = 10000000,
    ExcludeRange = false)]
public long MaxUsers
{
    get
    {
        return (long)this["maxUsers"];
    }
    set
    {
        this["maxUsers"] = value;
    }
}
<ConfigurationProperty("maxUsers", _
DefaultValue:=10000, _
IsRequired:=False), _
LongValidator(MinValue:=1, _
MaxValue:=10000000, _
ExcludeRange:=False)> _
Public Property MaxUsers() As Long
    Get
        Return Fix(Me("maxUsers"))
    End Get
    Set(ByVal value As Long)
        Me("maxUsers") = value
    End Set
End Property

注解

范围包含 MinValueMaxValue 属性值。The range is inclusive of the MinValue and MaxValue property values. ExcludeRange 属性值为时 false ,允许的值超出范围。When the ExcludeRange property value is false, the allowed values are outside the range.

适用于