AsyncServiceProviderInjection<TService,TInterface>.GetServiceAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GetServiceAsync() |
Asynchronously returns the retrieved service. |
GetServiceAsync(Boolean) |
Asynchronously returns the retrieved service. |
GetServiceAsync()
Asynchronously returns the retrieved service.
public System.Threading.Tasks.Task<TInterface> GetServiceAsync ();
member this.GetServiceAsync : unit -> System.Threading.Tasks.Task<'Interface (requires 'Interface : null)>
Public Function GetServiceAsync () As Task(Of TInterface)
Returns
An instance of the TService
service.
Exceptions
If there isn't any service of type TService
available.
Remarks
Multiple calls to this method will return the same instance of TInterface
.
Applies to
GetServiceAsync(Boolean)
Asynchronously returns the retrieved service.
public System.Threading.Tasks.Task<TInterface?> GetServiceAsync (bool assumePresent);
member this.GetServiceAsync : bool -> System.Threading.Tasks.Task<'Interface (requires 'Interface : null)>
Public Function GetServiceAsync (assumePresent As Boolean) As Task(Of TInterface)
Parameters
- assumePresent
- Boolean
Returns
An instance of the TService
service.
Exceptions
When assumePresent
is true
and
there isn't any service of type TService
available.
Remarks
Multiple calls to this method will return the same instance of TInterface
.