Partilhar via


ServiceProvider.GetService Method

Definition

Overloads

GetService(Guid)

Retrieves a service with a specified service GUID.

GetService(Type)

Retrieves a service of the specified type.

GetService(Guid)

Retrieves a service with a specified service GUID.

public:
 virtual System::Object ^ GetService(Guid serviceGuid);
public virtual object GetService (Guid serviceGuid);
abstract member GetService : Guid -> obj
override this.GetService : Guid -> obj
Public Overridable Function GetService (serviceGuid As Guid) As Object

Parameters

serviceGuid
Guid

The GUID of a service.

Returns

The service with the specified service GUID, or null if no service is found.

Applies to

GetService(Type)

Retrieves a service of the specified type.

public:
 virtual System::Object ^ GetService(Type ^ serviceType);
public virtual object GetService (Type serviceType);
abstract member GetService : Type -> obj
override this.GetService : Type -> obj
Public Overridable Function GetService (serviceType As Type) As Object

Parameters

serviceType
Type

The service type.

Returns

Returns the service of the specified type, or returns null if no service is found.

Implements

Exceptions

The serviceType parameter is null.

Applies to