Export (0) Print
Expand All

SettingsBase.Item Property

Gets or sets the value of the specified settings property.

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

public virtual Object this[
	string propertyName
] { get; set; }

Parameters

propertyName
Type: System.String

A String containing the name of the property to access.

Property Value

Type: System.Object
If found, the value of the named settings property.

ExceptionCondition
SettingsPropertyNotFoundException

There are no properties associated with the current object, 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 class derived from SettingsBase. The Item property binds the public property of the class to the corresponding settings property.

The first time a property is accessed, the SettingsBase instance will find all other properties that share the same provider as the requested property. The SettingsBase instance will then call the provider, passing it the set of SettingsProperty objects that represent the data the provider should retrieve.

Note that the indexer will get and set property data in a thread-safe manner if IsSynchronized is true. A SettingsBase instance by default is not thread safe. However, you can call Synchronized, passing in a SettingsBase instance to make the SettingsBase indexer operate in a thread-safe manner.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft