Table of Contents

Class Singleton<T>

Namespace
Exiled.API.Features.Core.Generic
Assembly
Exiled.API.dll

A class to handle object instances.

public sealed class Singleton<T> : TypeCastObject<T> where T : class

Type Parameters

T

The type of the object to handle the instance of.

Inheritance
Singleton<T>
Inherited Members
Extension Methods

Constructors

Singleton(T)

Initializes a new instance of the Singleton<T> class.

public Singleton(T value)

Parameters

value T

The branch to instantiate.

Properties

Instance

Gets the relative value.

public static T Instance { get; }

Property Value

T

Methods

Create(T)

A class to handle object instances.

public static void Create(T @object)

Parameters

object T

Destroy(T)

Destroys the given T instance.

public static bool Destroy(T @object)

Parameters

object T

The object to destroy.

Returns

bool

true if the instance was destroyed; otherwise, false.

~Singleton()

Finalizes an instance of the Singleton<T> class.

protected ~Singleton()

TryGet<TObject>(out TObject)

Tries to get the relative value.

public static bool TryGet<TObject>(out TObject instance) where TObject : class

Parameters

instance TObject

The object instance.

Returns

bool

true if the object instance is not null and can be casted as the specified type; otherwise, false.

Type Parameters

TObject

The type of the object.

Operators

implicit operator T(Singleton<T>)

Converts the given Singleton<T> instance into T.

public static implicit operator T(Singleton<T> instance)

Parameters

instance Singleton<T>

The Singleton<T> instance to convert.

Returns

T