ServiceProviderKeyedServiceExtensions.GetKeyedService<T> 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.
Get service of type T
from the IServiceProvider.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static T GetKeyedService(IServiceProvider ^ provider, System::Object ^ serviceKey);
public static T? GetKeyedService<T> (this IServiceProvider provider, object? serviceKey);
static member GetKeyedService : IServiceProvider * obj -> 'T
<Extension()>
Public Function GetKeyedService(Of T) (provider As IServiceProvider, serviceKey As Object) As T
Type Parameters
- T
The type of service object to get.
Parameters
- provider
- IServiceProvider
The IServiceProvider to retrieve the service object from.
- serviceKey
- Object
An object that specifies the key of service object to get.
Returns
T
A service object of type T
or null if there is no such service.
Applies to
التعاون معنا على GitHub
يمكن العثور على مصدر هذا المحتوى على GitHub حيث يمكنك أيضاً إضافة مشاكل وطلبات سحب ومراجعتها. للحصول على معلومات إضافية، اطلع على دليل المساهم لدينا.