ProviderCollection.Add(ProviderBase) 方法

定义

向集合中添加提供程序。Adds a provider to the collection.

public:
 virtual void Add(System::Configuration::Provider::ProviderBase ^ provider);
public virtual void Add (System.Configuration.Provider.ProviderBase provider);
abstract member Add : System.Configuration.Provider.ProviderBase -> unit
override this.Add : System.Configuration.Provider.ProviderBase -> unit
Public Overridable Sub Add (provider As ProviderBase)

参数

provider
ProviderBase

要添加的提供程序。The provider to be added.

异常

该集合是只读的。The collection is read-only.

providernullprovider is null.

providerNamenullThe Name of provider is null.

-or- providerName 的长度小于 1。The length of the Name of provider is less than 1.

注解

方法首先检查是否有任何异常 (如 "异常" 一节中所列), 然后Hashtable.Add调用方法。 AddThe Add method first checks for any exceptions (as listed in the Exceptions section), and then calls the Hashtable.Add method. 它传入provider参数引用的对象, 以及要用作Hashtable对象中的Name键的提供程序的属性。It passes in the object referenced by the provider parameter as well as the Name property of the provider to be used as the key in the Hashtable object.

适用于