This documentation is archived and is not being maintained.

ConfigurationPropertyAttribute.IsKey Property

Note: This property is new in the .NET Framework version 2.0.

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)

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 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0