ConfigurationPropertyAttribute.IsKey 属性    
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个值,该值指示此属性是否是该经过修饰的元素属性的 Key 属性。
public:
 property bool IsKey { bool get(); void set(bool value); };public bool IsKey { get; set; }member this.IsKey : bool with get, setPublic Property IsKey As Boolean属性值
如果此属性是该集合中元素的 Key 属性,则为 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。