Szerkesztés

Megosztás a következőn keresztül:


Container.GetService(Type) Method

Definition

Gets the service object of the specified type, if it is available.

protected:
 virtual System::Object ^ GetService(Type ^ service);
protected virtual object GetService (Type service);
protected virtual object? GetService (Type service);
abstract member GetService : Type -> obj
override this.GetService : Type -> obj
Protected Overridable Function GetService (service As Type) As Object

Parameters

service
Type

The Type of the service to retrieve.

Returns

An Object implementing the requested service, or null if the service cannot be resolved.

Remarks

The default implementation of this method returns the current instance of the class if service is an IContainer; otherwise, it returns null. You can override this method to provide a custom implementation to return a service object. For more information, see the IServiceProvider.GetService method.

Applies to

See also