NamedServiceProviderExtensions.GetRequiredService<TService> Method
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.
Get service of type TService
from the INamedServiceProvider<TService>.
public:
generic <typename TService>
where TService : class[System::Runtime::CompilerServices::Extension]
static TService GetRequiredService(Microsoft::Extensions::DependencyInjection::INamedServiceProvider<TService> ^ provider, System::String ^ name);
public static TService GetRequiredService<TService>(this Microsoft.Extensions.DependencyInjection.INamedServiceProvider<TService> provider, string name) where TService : class;
static member GetRequiredService : Microsoft.Extensions.DependencyInjection.INamedServiceProvider<'Service (requires 'Service : null)> * string -> 'Service (requires 'Service : null)
<Extension()>
Public Function GetRequiredService(Of TService As Class) (provider As INamedServiceProvider(Of TService), name As String) As TService
- TService
The type of service object to get.
- provider
- INamedServiceProvider<TService>
The INamedServiceProvider<TService> to retrieve the service object from.
- name
- String
The name of the service.
A service object of type TService
.
There is no service of type TService
with the name.
This method returns the latest TService
registered under the name.
Proizvod | Verzije |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET povratne informacije
.NET je projekat otvorenog koda. Odaberite vezu za pružanje povratnih informacija: