Show / Hide Table of Contents

Class ServiceLocator

Inheritance
object
ServiceLocator
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: GigaCreation.Tools.Service
Assembly: GigaCreation.Tools.Service.dll
Syntax
public static class ServiceLocator

Methods

| Improve this Doc View Source

Get<TService>()

Get a service.

Declaration
public static TService Get<TService>() where TService : class, IService
Returns
Type Description
TService

The service of the requested type.

Type Parameters
Name Description
TService

The type of a service.

| Improve this Doc View Source

IsRegistered<TService>()

Checks if a service of the specified type is registered.

Declaration
public static bool IsRegistered<TService>() where TService : class, IService
Returns
Type Description
bool

Returns true if a service of the given type is registered.

Type Parameters
Name Description
TService

The type of a service to check.

| Improve this Doc View Source

IsRegistered<TService>(TService)

Checks if the specified service is registered.

Declaration
public static bool IsRegistered<TService>(TService service) where TService : class, IService
Parameters
Type Name Description
TService service

The service to check.

Returns
Type Description
bool

Returns true if the given service is registered.

Type Parameters
Name Description
TService

The type of a service to check.

| Improve this Doc View Source

Register<TService>(TService)

Register a service. If a service of the same type is already registered, you should unregister it first.

Declaration
public static void Register<TService>(TService service) where TService : class, IService
Parameters
Type Name Description
TService service

The service to register.

Type Parameters
Name Description
TService

The type of the service.

| Improve this Doc View Source

TryGet<TService>(out TService)

Try to get a service.

Declaration
public static bool TryGet<TService>(out TService service) where TService : class, IService
Parameters
Type Name Description
TService service

The service of the requested type.

Returns
Type Description
bool

Returns true if the get was successful.

Type Parameters
Name Description
TService

The type of a service.

| Improve this Doc View Source

Unregister<TService>(TService)

Unregister a service.

Declaration
public static void Unregister<TService>(TService service) where TService : class, IService
Parameters
Type Name Description
TService service

The service to unregister.

Type Parameters
Name Description
TService

The type of the service.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX