ServiceProviders.AddService(Type, Object) 方法

定义

将服务添加到列表。Adds a service to the list.

public:
 void AddService(Type ^ serviceType, System::Object ^ service);
public void AddService (Type serviceType, object service);
member this.AddService : Type * obj -> unit
Public Sub AddService (serviceType As Type, service As Object)

参数

serviceType
Type

新服务的服务类型。Service type of the new service.

service
Object

服务实现类。The service implementation class.

异常

serviceTypeservicenullserviceType or service is null.

尝试添加一个已经在字典中存在的服务。Attempted to add a service that already exists in the dictionary.

适用于