RegexStringValidatorAttribute Klasa

Definicja

Deklaratywnie nakazuje platformie .NET przeprowadzenie weryfikacji ciągu we właściwości konfiguracji przy użyciu wyrażenia regularnego. Klasa ta nie może być dziedziczona.

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

Przykłady

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

[ConfigurationProperty("alias2", DefaultValue = "alias.txt",
    IsRequired = true, IsKey = false)]
[RegexStringValidator(@"\w+\S*")]
public string Alias2
{
    get
    {
        return (string)this["alias2"];
    }
    set
    {
        this["alias2"] = value;
    }
}
<ConfigurationProperty("alias2", _
DefaultValue:="alias.txt", _
IsRequired:=True, _
IsKey:=False), _
RegexStringValidator("\w+\S*")> _
Public Property Alias2() As String
    Get
        Return CStr(Me("alias2"))
    End Get
    Set(ByVal value As String)
        Me("alias2") = value
    End Set
End Property

Uwagi

Element służy RegexStringValidatorAttribute do dekorowania właściwości konfiguracji, która instruuje platformę .NET, aby zweryfikować właściwość przy użyciu RegexStringValidator i przekazać do niej wartość parametrów dekorowania.

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

Konstruktory

RegexStringValidatorAttribute(String)

Inicjuje RegexStringValidatorAttribute nowe wystąpienie obiektu.

Właściwości

Regex

Pobiera ciąg używany do sprawdzania poprawności wyrażeń regularnych.

TypeId

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

(Odziedziczone po Attribute)
ValidatorInstance

Pobiera wystąpienie RegexStringValidator 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ż