ServiceProviderServiceExtensions.GetServices 方法

定义

重载

GetServices(IServiceProvider, Type)

IServiceProvider 获取 serviceType 类型服务的枚举。

GetServices<T>(IServiceProvider)

IServiceProvider 获取 T 类型服务的枚举。

GetServices(IServiceProvider, Type)

Source:
ServiceProviderServiceExtensions.cs
Source:
ServiceProviderServiceExtensions.cs

IServiceProvider 获取 serviceType 类型服务的枚举。

public:
[System::Runtime::CompilerServices::Extension]
 static System::Collections::Generic::IEnumerable<System::Object ^> ^ GetServices(IServiceProvider ^ provider, Type ^ serviceType);
public static System.Collections.Generic.IEnumerable<object?> GetServices (this IServiceProvider provider, Type serviceType);
static member GetServices : IServiceProvider * Type -> seq<obj>
<Extension()>
Public Function GetServices (provider As IServiceProvider, serviceType As Type) As IEnumerable(Of Object)

参数

provider
IServiceProvider

从中检索服务的 IServiceProvider

serviceType
Type

一个对象,它指定要获取的服务对象的类型。

返回

serviceType 类型服务的枚举。

适用于

GetServices<T>(IServiceProvider)

Source:
ServiceProviderServiceExtensions.cs
Source:
ServiceProviderServiceExtensions.cs

IServiceProvider 获取 T 类型服务的枚举。

public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
 static System::Collections::Generic::IEnumerable<T> ^ GetServices(IServiceProvider ^ provider);
public static System.Collections.Generic.IEnumerable<T> GetServices<T> (this IServiceProvider provider);
static member GetServices : IServiceProvider -> seq<'T>
<Extension()>
Public Function GetServices(Of T) (provider As IServiceProvider) As IEnumerable(Of T)

类型参数

T

要获取的服务对象的类型。

参数

provider
IServiceProvider

从中检索服务的 IServiceProvider

返回

T 类型服务的枚举。

适用于