KeyedServiceCollectionExtensions.GetServiceByName<TService> 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.
Acquire a service by name.
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
Type Parameters
- TService
The service type.
Parameters
- services
- IServiceProvider
The service provider.
- name
- String
The service name.
Returns
TService
The service.