Search Results for

    Show / Hide Table of Contents

    Class ServiceProviderServiceExtensions

    Extension methods for getting services from an IServiceProvider.

    Inheritance
    object
    ServiceProviderServiceExtensions
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: nanoFramework.DependencyInjection
    Assembly: nanoFramework.DependencyInjection.dll
    Syntax
    public static class ServiceProviderServiceExtensions

    Methods

    GetRequiredService(IServiceProvider, Type)

    Get service of type serviceType from the IServiceProvider.

    Declaration
    public static object GetRequiredService(this IServiceProvider provider, Type serviceType)
    Parameters
    Type Name Description
    IServiceProvider provider

    The IServiceProvider to retrieve the service object from.

    Type serviceType

    An object that specifies the type of service object to get.

    Returns
    Type Description
    object

    A service object of type serviceType.

    Exceptions
    Type Condition
    InvalidOperationException

    There is no service of type serviceType.

    ArgumentNullException

    provider or serviceType can't be null.

    GetServices(IServiceProvider, Type)

    Get an enumeration of services of type serviceType from the IServiceProvider.

    Declaration
    public static object[] GetServices(this IServiceProvider provider, Type serviceType)
    Parameters
    Type Name Description
    IServiceProvider provider

    The IServiceProvider to retrieve the services from.

    Type serviceType

    An object that specifies the type of service object to get.

    Returns
    Type Description
    object[]

    An array of services of type serviceType.

    GetServices(IServiceProvider, Type[])

    Get an enumeration of services of type serviceType from the IServiceProvider.

    Declaration
    public static object[] GetServices(this IServiceProvider provider, Type[] serviceType)
    Parameters
    Type Name Description
    IServiceProvider provider

    The IServiceProvider to retrieve the services from.

    Type[] serviceType

    An array of serviceType object that specifies the type of service object to get.

    Returns
    Type Description
    object[]

    An array of services of type serviceType.

    Exceptions
    Type Condition
    ArgumentNullException

    'provider' or 'serviceType' can't be null.

    In This Article
    Back to top Copyright © 2023 nanoFramework Contributors
    Generated by DocFX