ApplicationSettingsBase.Item Property

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

Gets or sets the value of the specified application settings property.

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

public override Object this [
	string propertyName
] { get; set; 
/** @property */
public Object get_Item (String propertyName)

/** @property */
public void set_Item (String propertyName, Object value)

JScript supports the use of indexed properties, but not the declaration of new ones.

Parameters

propertyName

A String containing the name of the property to access.

Property Value

If found, the value of the named settings property; otherwise, a null reference (Nothing in Visual Basic).

Exception typeCondition

SettingsPropertyNotFoundException

There are no properties associated with the current wrapper or the specified property could not be found.

SettingsPropertyIsReadOnlyException

An attempt was made to set a read-only property.

SettingsPropertyWrongTypeException

The value supplied is of a type incompatible with the settings property, during a set operation.

The Item property, also known as the indexer, is routinely used in the settings wrapper class derived from ApplicationSettingsBase. Item binds the public property of the wrapper class to the corresponding settings property.

Item raises several events depending on the operation being performed:

  • The first time a property is retrieved, the SettingsLoaded event is raised.

  • When a property is set, the OnSettingChanging event is raised. If the handler does not cancel the event, then the property value is set and the PropertyChanged event is raised.

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
Show: