IntegerValidatorAttribute Klasa

Definicja

Deklaratywnie nakazuje platformie .NET przeprowadzenie weryfikacji liczby całkowitej we właściwości konfiguracji. Klasa ta nie może być dziedziczona.

public ref class IntegerValidatorAttribute sealed : System::Configuration::ConfigurationValidatorAttribute
[System.AttributeUsage(System.AttributeTargets.Property)]
public sealed class IntegerValidatorAttribute : System.Configuration.ConfigurationValidatorAttribute
[<System.AttributeUsage(System.AttributeTargets.Property)>]
type IntegerValidatorAttribute = class
    inherit ConfigurationValidatorAttribute
Public NotInheritable Class IntegerValidatorAttribute
Inherits ConfigurationValidatorAttribute
Dziedziczenie
Atrybuty

Przykłady

W poniższym przykładzie pokazano, jak udekorować właściwości obiektu niestandardowego ConfigurationSection przy użyciu atrybutu IntegerValidatorAttribute .

[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;
    }
}
<ConfigurationProperty("maxAttempts", _
DefaultValue:=101, _
IsRequired:=True), _
IntegerValidator(MinValue:=1, _
MaxValue:=100, _
ExcludeRange:=True)> _
Public Property MaxAttempts() As Integer
    Get
        Return Fix(Me("maxAttempts"))
    End Get
    Set(ByVal value As Integer)
        Me("maxAttempts") = value
    End Set
End Property

Uwagi

Atrybut służy IntegerValidatorAttribute do dekorowania właściwości konfiguracji, która spowoduje, że platforma .NET zweryfikuje właściwość przy użyciu IntegerValidator obiektu i przekaże do niej wartość parametrów dekorowania.

Atrybuty można stosować IntegerValidatorAttribute tylko do typów właściwości.

Konstruktory

IntegerValidatorAttribute()

Tworzy nowe wystąpienie klasy IntegerValidatorAttribute.

Właściwości

ExcludeRange

Pobiera lub ustawia wartość wskazującą, czy należy uwzględnić lub wykluczyć liczby całkowite w zakresie zdefiniowanym MinValue przez wartości właściwości i MaxValue .

MaxValue

Pobiera lub ustawia maksymalną dozwoloną wartość dla właściwości.

MinValue

Pobiera lub ustawia minimalną dozwoloną wartość dla właściwości .

TypeId

Po zaimplementowaniu w klasie pochodnej pobiera unikatowy identyfikator dla tego Attributeelementu .

(Odziedziczone po Attribute)
ValidatorInstance

Pobiera wystąpienie IntegerValidator klasy .

ValidatorType

Pobiera typ atrybutu modułu sprawdzania poprawności.

(Odziedziczone po ConfigurationValidatorAttribute)

Metody

Equals(Object)

Zwraca wartość wskazującą, czy to wystąpienie jest równe podanemu obiektowi.

(Odziedziczone po Attribute)
GetHashCode()

Zwraca wartość skrótu dla tego wystąpienia.

(Odziedziczone po Attribute)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
IsDefaultAttribute()

Podczas zastępowania w klasie pochodnej wskazuje, czy wartość tego wystąpienia jest wartością domyślną dla klasy pochodnej.

(Odziedziczone po Attribute)
Match(Object)

Po przesłonięciu w klasie pochodnej zwraca wartość wskazującą, czy to wystąpienie jest równe określonemu obiektowi.

(Odziedziczone po Attribute)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Jawne implementacje interfejsu

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Zestaw nazw jest mapowany na odpowiedni zestaw identyfikatorów wysyłania.

(Odziedziczone po Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Pobiera informacje o typie dla obiektu, który może służyć do pobierania informacji o typie dla interfejsu.

(Odziedziczone po Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Pobiera informację o liczbie typów interfejsów, jakie zawiera obiekt (0 lub 1).

(Odziedziczone po Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Umożliwia dostęp do właściwości i metod udostępnianych przez obiekt.

(Odziedziczone po Attribute)

Dotyczy

Zobacz też