Init(args)
Scripting Reference
Loading...
Searching...
No Matches

◆ TryGet()

static bool Sisus.Init.ServiceUtility.TryGet ( [DisallowNull] Type definingType,
out object service )
static

Gets the shared service instance of the given serviceType .

The returned object's class will match the provided serviceType , derive from it or implement an interface of the type.

Parameters
definingTypeThe defining type of the service; the class or interface type that uniquely defines the service and can be used to retrieve an instance of it.

This must be an interface that the service implement, a base type that the service derives from, or the exact type of the service.

Returns
Exceptions
NullReferenceExceptionThrown if no service of type TService is found that is globally accessible to any client.