KeyedServiceCollectionExtensions.GetRequiredServiceByName<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, throwing if it is not found.
public static TService GetRequiredServiceByName<TService> (this IServiceProvider services, string name) where TService : class;
static member GetRequiredServiceByName : IServiceProvider * string -> 'Service (requires 'Service : null)
<Extension()>
Public Function GetRequiredServiceByName(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.