IntegerValidatorAttribute.MaxValue プロパティ

定義

プロパティに指定できる最大値を取得または設定します。

C#
public int MaxValue { get; set; }

プロパティ値

指定できる最大値を示す整数。

例外

選択した値が MinValue 未満です。

MaxValue プロパティを使用する方法を次の例に示します。

C#
[ConfigurationProperty("maxAttempts", DefaultValue = 101,
    IsRequired = true)]
[IntegerValidator(MinValue = 1, MaxValue = 100,
    ExcludeRange = true)]
public int MaxAttempts
{
    get
    {
        return (int)this["maxAttempts"];
    }
    set
    {
        this["maxAttempts"] = value;
    }
}

注釈

プロパティの MaxValue 値は、許容範囲に含まれます。

適用対象

製品 バージョン
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9