共用方式為


KeyedServiceExtensions.GetServiceByName<TService> 方法

定義

依名稱取得服務。

public static TService GetServiceByName<TService> (this IServiceProvider services, string name) where TService : class;
static member GetServiceByName : IServiceProvider * string -> 'Service (requires 'Service : null)
<Extension()>
Public Function GetServiceByName(Of TService As Class) (services As IServiceProvider, name As String) As TService

類型參數

TService

參數

services
IServiceProvider
name
String

傳回

TService

適用於