AsyncServiceProviderInjection<TService,TInterface>.GetServiceAsync 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
GetServiceAsync() |
异步返回检索到的服务。 |
GetServiceAsync(Boolean) |
异步返回检索到的服务。 |
GetServiceAsync()
异步返回检索到的服务。
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)
返回
Task<TInterface>
服务的实例 TService
。
例外
如果没有任何类型的 TService
服务可用。
注解
对此方法的多次调用将返回 的同一实例 TInterface
。
适用于
GetServiceAsync(Boolean)
异步返回检索到的服务。
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)
参数
- assumePresent
- Boolean
返回
Task<TInterface>
服务的实例 TService
。
例外
当 assumePresent
为 true
时,没有任何类型的 TService
服务可用。
注解
对此方法的多次调用将返回 的同一实例 TInterface
。