ConfigurationPropertyAttribute.IsRequired Property


Gets or sets a value indicating whether the decorated element property is required.

Namespace:   System.Configuration
Assembly:  System.Configuration (in System.Configuration.dll)

Public Property IsRequired As Boolean

Property Value

Type: System.Boolean

true if the property is required; otherwise, false. The default is false.

The following example shows how to use the DefaultValue property.

<ConfigurationProperty("url", DefaultValue:="", IsRequired:=True), RegexStringValidator("\w+:\/\/[\w.]+\S*")>
Public Property Url() As String
        Return CStr(Me("url"))
    End Get
    Set(ByVal value As String)
        Me("url") = value
    End Set
End Property

.NET Framework
Available since 2.0
Return to top