ProviderBase.Initialize Method (System.Configuration.Provider)

Switch View :
ScriptFree
.NET Framework Class Library
ProviderBase.Initialize Method

Initializes the provider.

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

Visual Basic
Public Overridable Sub Initialize ( _
	name As String, _
	config As NameValueCollection _
)
C#
public virtual void Initialize(
	string name,
	NameValueCollection config
)
Visual C++
public:
virtual void Initialize(
	String^ name, 
	NameValueCollection^ config
)
F#
abstract Initialize : 
        name:string * 
        config:NameValueCollection -> unit 
override Initialize : 
        name:string * 
        config:NameValueCollection -> unit 

Parameters

name
Type: System.String
The friendly name of the provider.
config
Type: System.Collections.Specialized.NameValueCollection
A collection of the name/value pairs representing the provider-specific attributes specified in the configuration for this provider.
Exceptions

Exception Condition
ArgumentNullException

The name of the provider is null.

ArgumentException

The name of the provider has a length of zero.

InvalidOperationException

An attempt is made to call Initialize on a provider after the provider has already been initialized.

Remarks

The base class implementation internally tracks the number of times the provider's Initialize method has been called. If a provider is initialized more than once, an InvalidOperationException is thrown stating that the provider is already initialized.

Because most feature providers call Initialize prior to performing provider-specific initialization, this method is a central location for preventing double initialization.

Examples

For an example of how to use Initialize, see Profile Provider Implementation Example.

Version Information

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Reference

Other Resources