Export (0) Print
Expand All

ConfigurationPropertyAttribute.IsKey Property

Gets or sets a value indicating whether this is a key property for the decorated element property.

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

public bool IsKey { get; set; }
/** @property */
public boolean get_IsKey ()

/** @property */
public void set_IsKey (boolean value)

public function get IsKey () : boolean

public function set IsKey (value : boolean)

Not applicable.

Property Value

true if the property is a key property for an element of the collection; otherwise, false. The default is false.

The IsKey property applies only if the property you decorate is a collection. It does not have any effect if the property is not a collection. Multiple elements can be marked as IsKey.

The following example shows how to use the IsKey property.

[ConfigurationProperty("fileName", DefaultValue = "default.txt",
    IsRequired = true, IsKey = false)]
[StringValidator(InvalidCharacters = " ~!@#$%^&*()[]{}/;'\"|\\",
    MinLength = 1, MaxLength = 60)]
public string FileName
        return (string)this["fileName"];
        this["fileName"] = value;

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

© 2014 Microsoft