ConfigurationPropertyAttribute.DefaultValue Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
The object representing the default value of the decorated configuration-element property.
Examples
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
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.