Share via


AsyncPackage.GetService(Type) Method

Definition

Retrieves a service registered with this package synchronously, falling back to the asynchronous GlobalProvider and synchronous GlobalProvider if there is no service with this identity registered with the package.

protected:
 override System::Object ^ GetService(Type ^ serviceType);
protected:
 override Platform::Object ^ GetService(Platform::Type ^ serviceType);
protected override object GetService (Type serviceType);
protected override object? GetService (Type serviceType);
override this.GetService : Type -> obj
Protected Overrides Function GetService (serviceType As Type) As Object

Parameters

serviceType
Type

The service identity of the service to retrieve.

Returns

The requested service or null for failures that do not result in exceptions.

Exceptions

serviceType is null.

The service was registered with this package and the service threw an exception during activation.

Remarks

This method retrieves both synchronous and asynchronous registered services.

This method is safe to access from any thread.

Applies to