ImageSourceServiceCollectionExtensions.AddService 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
AddService<TImageSource,TImageSourceService>(IImageSourceServiceCollection) |
透過 AddSingleton 向基礎服務容器註冊映像服務。 |
AddService<TImageSource>(IImageSourceServiceCollection, Func<IServiceProvider,IImageSourceService<TImageSource>>) |
透過 AddSingleton 向基礎服務容器註冊映像服務。 |
AddService<TImageSource,TImageSourceService>(IImageSourceServiceCollection)
透過 AddSingleton 向基礎服務容器註冊映像服務。
public:
generic <typename TImageSource, typename TImageSourceService>
where TImageSource : Microsoft::Maui::IImageSource where TImageSourceService : class, Microsoft::Maui::IImageSourceService<TImageSource>[System::Runtime::CompilerServices::Extension]
static Microsoft::Maui::Hosting::IImageSourceServiceCollection ^ AddService(Microsoft::Maui::Hosting::IImageSourceServiceCollection ^ services);
public static Microsoft.Maui.Hosting.IImageSourceServiceCollection AddService<TImageSource,TImageSourceService> (this Microsoft.Maui.Hosting.IImageSourceServiceCollection services) where TImageSource : Microsoft.Maui.IImageSource where TImageSourceService : class, Microsoft.Maui.IImageSourceService<TImageSource>;
static member AddService : Microsoft.Maui.Hosting.IImageSourceServiceCollection -> Microsoft.Maui.Hosting.IImageSourceServiceCollection (requires 'ImageSource :> Microsoft.Maui.IImageSource and 'ImageSourceService : null and 'ImageSourceService :> Microsoft.Maui.IImageSourceService<'ImageSource>)
<Extension()>
Public Function AddService(Of TImageSource As IImageSource, TImageSourceService As IImageSource) (services As IImageSourceServiceCollection) As IImageSourceServiceCollection
類型參數
- TImageSource
要註冊的映像類型
- TImageSourceService
要註冊的服務類型
參數
- services
- IImageSourceServiceCollection
服務集合
傳回
服務集合
適用於
AddService<TImageSource>(IImageSourceServiceCollection, Func<IServiceProvider,IImageSourceService<TImageSource>>)
透過 AddSingleton 向基礎服務容器註冊映像服務。
public:
generic <typename TImageSource>
where TImageSource : Microsoft::Maui::IImageSource[System::Runtime::CompilerServices::Extension]
static Microsoft::Maui::Hosting::IImageSourceServiceCollection ^ AddService(Microsoft::Maui::Hosting::IImageSourceServiceCollection ^ services, Func<IServiceProvider ^, Microsoft::Maui::IImageSourceService<TImageSource> ^> ^ implementationFactory);
public static Microsoft.Maui.Hosting.IImageSourceServiceCollection AddService<TImageSource> (this Microsoft.Maui.Hosting.IImageSourceServiceCollection services, Func<IServiceProvider,Microsoft.Maui.IImageSourceService<TImageSource>> implementationFactory) where TImageSource : Microsoft.Maui.IImageSource;
static member AddService : Microsoft.Maui.Hosting.IImageSourceServiceCollection * Func<IServiceProvider, Microsoft.Maui.IImageSourceService<'ImageSource>> -> Microsoft.Maui.Hosting.IImageSourceServiceCollection (requires 'ImageSource :> Microsoft.Maui.IImageSource)
<Extension()>
Public Function AddService(Of TImageSource As IImageSource) (services As IImageSourceServiceCollection, implementationFactory As Func(Of IServiceProvider, IImageSourceService(Of TImageSource))) As IImageSourceServiceCollection
類型參數
- TImageSource
要註冊的映像類型
參數
- services
- IImageSourceServiceCollection
服務集合
- implementationFactory
- Func<IServiceProvider,IImageSourceService<TImageSource>>
用來建立服務的 Factory 方法
傳回
服務集合