ConfigurationPropertyAttribute.IsRequired 속성
정의
데코레이팅된 요소 속성이 필요한지 여부를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value indicating whether the decorated element property is required.
public:
property bool IsRequired { bool get(); void set(bool value); };
public bool IsRequired { get; set; }
member this.IsRequired : bool with get, set
Public Property IsRequired As Boolean
속성 값
속성이 필요하면 true
이고, 그렇지 않으면 false
입니다.true
if the property is required; otherwise, false
. 기본값은 false
입니다.The default is false
.
예제
다음 예제에서는 DefaultValue 속성을 사용하는 방법을 보여 줍니다.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