Singleton<T> Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Caution
This helper will be removed in a future release, see example tag for code replacement. https://github.com/windows-toolkit/WindowsCommunityToolkit/issues/3134
[System.Obsolete("This helper will be removed in a future release, see example tag for code replacement. https://github.com/windows-toolkit/WindowsCommunityToolkit/issues/3134")]
public static class Singleton<T> where T : new()
[<System.Obsolete("This helper will be removed in a future release, see example tag for code replacement. https://github.com/windows-toolkit/WindowsCommunityToolkit/issues/3134")>]
type Singleton<'T (requires 'T : (new : unit -> 'T))> = class
Public Class Singleton(Of T)
Type Parameters
- T
The type to be used for creating the Singleton instance.
- Inheritance
-
Singleton<T>
- Attributes
Examples
Instead of this helper, migrate your code to this pattern instead:
// Setup Singleton
public class MyClass
{
public static MyClass Instance { get; } = new MyClass();
}
Properties
Instance |
Gets the instance of the Singleton class. |