ConfigurationPropertyAttribute.IsKey 속성

정의

속성이 데코레이팅된 요소 속성의 키 속성인지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool IsKey { bool get(); void set(bool value); };
public bool IsKey { get; set; }
member this.IsKey : bool with get, set
Public Property IsKey As Boolean

속성 값

속성이 컬렉션의 요소에 대한 키 속성이면 true이고, 그렇지 않으면 false입니다. 기본값은 false입니다.

예제

다음 예제에서는 IsKey 속성을 사용하는 방법을 보여 줍니다.

[ConfigurationProperty("name", DefaultValue = "Contoso",
    IsRequired = true, IsKey = true)]
public string Name
{
    get
    {
        return (string)this["name"];
    }
    set
    {
        this["name"] = value;
    }
}
<ConfigurationProperty("name", DefaultValue:="Contoso", IsRequired:=True, IsKey:=True)>
Public Property Name() As String
    Get
        Return CStr(Me("name"))
    End Get
    Set(ByVal value As String)
        Me("name") = value
    End Set
End Property

설명

속성은 IsKey 데코레이팅하는 속성이 컬렉션인 경우에만 적용됩니다. 속성이 컬렉션이 아닌 경우에는 아무런 영향을 주지 않습니다. 여러 요소를 로 IsKey표시할 수 있습니다.

적용 대상