Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    ServiceRegistryExtensions Class

    Namespace: Stride.Core
    Assembly: Stride.Core.dll
    System.Object → ServiceRegistryExtensions
    Derived from ServiceRegistryExtensions:

    public static class ServiceRegistryExtensions
    Name Description
    Methods
    GetSafeServiceAs<T>(IServiceRegistry)

    Gets a service instance from a specified interface contract.

    GetServiceAs<T>(IServiceRegistry)

    Gets a service instance from a specified interface contract.

    GetServiceLate<T>(IServiceRegistry, Action<T>)

    Gets a service instance from a specified interface contract.

    | Improve this Doc View Source

    Methods


    GetSafeServiceAs<T>(IServiceRegistry)

    Gets a service instance from a specified interface contract.

    public static T GetSafeServiceAs<T>(this IServiceRegistry registry)
        where T : class
    Parameters
    Type Name Description
    IServiceRegistry registry

    The registry.

    Returns
    Type Description
    T

    An instance of the requested service registered to this registry.

    Type Parameters
    Name Description
    T

    Type of the interface contract of the service

    Exceptions
    Type Condition
    ServiceNotFoundException

    If the service was not found


    GetServiceAs<T>(IServiceRegistry)

    Gets a service instance from a specified interface contract.

    [Obsolete("Use the generic overload of IServiceRegistry.GetService instead")]
    public static T GetServiceAs<T>(this IServiceRegistry registry)
        where T : class
    Parameters
    Type Name Description
    IServiceRegistry registry

    The registry.

    Returns
    Type Description
    T

    An instance of the requested service registered to this registry.

    Type Parameters
    Name Description
    T

    Type of the interface contract of the service


    GetServiceLate<T>(IServiceRegistry, Action<T>)

    Gets a service instance from a specified interface contract.

    public static void GetServiceLate<T>(this IServiceRegistry registry, Action<T> serviceReady)
        where T : class
    Parameters
    Type Name Description
    IServiceRegistry registry

    The registry.

    System.Action<T> serviceReady

    The service ready.

    Type Parameters
    Name Description
    T

    Type of the interface contract of the service

    Exceptions
    Type Condition
    ServiceNotFoundException

    If the service was not found


    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation