Skip to content

Singleton<T>

Namespace: SideXP.Core

public abstract class Singleton<T>

Implements a thread-safe version of the Singleton pattern. The goal is to make an instance of a class unique and accessible from anywhere. Note that Singletons are considered as anti-patterns, and may be used only for prototyping quickly or if it's the only solution in your software architecture. The implementation is inspired from: https://jlambert.developpez.com/tutoriels/dotnet/implementation-pattern-singleton-csharp

Constructors

Singleton()

protected Singleton()

Default constructor.

Properties

Instance

public static T Instance

Gets the singleton instance of this class.

I

public static T I

Gets the singleton instance of this class.

Methods

Init()

protected virtual void Init()

Called when this object is set as the singleton instance.