Export (0) Print
Expand All

SettingsProviderCollection.Add Method

Adds a new settings provider to the collection.

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

public override void Add(
	ProviderBase provider
)

Parameters

provider
Type: System.Configuration.Provider.ProviderBase

A ProviderBase to add to the collection.

ExceptionCondition
ArgumentException

The provider parameter is not of type SettingsProvider.

-or-

The Name property of the provider parameter is null or an empty string.

-or-

A settings provider with the same Name already exists in the collection.

NotSupportedException

The collection is read-only.

ArgumentNullException

The provider parameter is null.

The Name property of the SettingsProvider is used as the storage key.

Caution noteCaution

Although the Add method has a single ProviderBase parameter to match the signature of this same method in the base class ProviderCollection, this method will throw an exception if the provider parameter is not of type SettingsProvider.

.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