SettingsProviderCollection.Add Method (ProviderBase)

 

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.

Exception Condition
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.

System_CAPS_cautionCaution

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
Available since 2.0
Return to top
Show: