Class Singleton<T>
A class to handle object instances.
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Exiled.API.Features.Core.Generic
Assembly: Exiled.API.dll
Syntax
public sealed class Singleton<T> : TypeCastObject<T> where T : class
Type Parameters
Name | Description |
---|---|
T | The type of the object to handle the instance of. |
Constructors
| Improve this Doc View SourceSingleton(T)
Initializes a new instance of the Singleton<T> class.
Declaration
public Singleton(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The branch to instantiate. |
Properties
| Improve this Doc View SourceInstance
Gets the relative value.
Declaration
public static T Instance { get; }
Property Value
Type | Description |
---|---|
T |
Methods
| Improve this Doc View SourceCreate(T)
Declaration
public static void Create(T object)
Parameters
Type | Name | Description |
---|---|---|
T | object |
Destroy(T)
Destroys the given T
instance.
Declaration
public static bool Destroy(T object)
Parameters
Type | Name | Description |
---|---|---|
T | object | The object to destroy. |
Returns
Type | Description |
---|---|
System.Boolean | true if the instance was destroyed; otherwise, false. |
Finalize()
Finalizes an instance of the Singleton<T> class.
Declaration
protected void Finalize()
TryGet<TObject>(out TObject)
Tries to get the relative value.
Declaration
public static bool TryGet<TObject>(out TObject instance)
where TObject : class
Parameters
Type | Name | Description |
---|---|---|
TObject | instance | The object instance. |
Returns
Type | Description |
---|---|
System.Boolean | true if the object instance is not null and can be casted as the specified type; otherwise, false. |
Type Parameters
Name | Description |
---|---|
TObject | The type of the object. |
Operators
| Improve this Doc View SourceImplicit(Singleton<T> to T)
Converts the given Singleton<T> instance into T
.
Declaration
public static implicit operator T(Singleton<T> instance)
Parameters
Type | Name | Description |
---|---|---|
Singleton<T> | instance | The Singleton<T> instance to convert. |
Returns
Type | Description |
---|---|
T |