ConfigurationPropertyAttribute.DefaultValue Property

Definition

Ruft den Standardwert für die ergänzte Eigenschaft ab oder legt diesen fest.Gets or sets the default value for the decorated property.

public:
 property System::Object ^ DefaultValue { System::Object ^ get(); void set(System::Object ^ value); };
public object DefaultValue { get; set; }
member this.DefaultValue : obj with get, set
Public Property DefaultValue As Object

Property Value

Object

Das Objekt, das den Standardwert der ergänzten Eigenschaft des Konfigurationselements darstellt.The object representing the default value of the decorated configuration-element property.

Examples

Im folgenden Beispiel wird die Verwendung der DefaultValue-Eigenschaft veranschaulicht.The following example shows how to use the DefaultValue property.

[ConfigurationProperty("url", DefaultValue = "http://www.contoso.com",
    IsRequired = true)]
[RegexStringValidator(@"\w+:\/\/[\w.]+\S*")]
public string Url
{
    get
    {
        return (string)this["url"];
    }
    set
    {
        this["url"] = value;
    }
}
<ConfigurationProperty("url", DefaultValue:="http://www.contoso.com", IsRequired:=True), RegexStringValidator("\w+:\/\/[\w.]+\S*")>
Public Property Url() As String
    Get
        Return CStr(Me("url"))
    End Get
    Set(ByVal value As String)
        Me("url") = value
    End Set
End Property

Applies to