Singletons.Net
1.1.0.3
dotnet add package Singletons.Net --version 1.1.0.3
NuGet\Install-Package Singletons.Net -Version 1.1.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Singletons.Net" Version="1.1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Singletons.Net" Version="1.1.0.3" />
<PackageReference Include="Singletons.Net" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Singletons.Net --version 1.1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Singletons.Net, 1.1.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Singletons.Net@1.1.0.3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Singletons.Net&version=1.1.0.3
#tool nuget:?package=Singletons.Net&version=1.1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Singletons.Net
A library containing a variety of Singleton approaches that can be leveraged.
Installation
Nuget
The recommended installation approach is to use the available nuget package: Singletons.Net
Clone
Alternatively, you can clone this repo and reference the Singletons.Net project in your project.
Features
- A variety of different Singletons that can be used in a .Net project
- A base singleton class that can be used to implement new singletons
Available Singletons
Singleton Type | Description | Documentation | Minimum Version | Maximum Version |
---|---|---|---|---|
SingletonBase | Base class for implementing thread-safe, lazy singletons via inheritance. | SingletonBase | 1.0.0.0 | |
AsyncSingleton | Async, thread-safe singleton for types needing async initialization. | AsyncSingleton | 1.0.0.0 | |
DisposableSingleton | Singleton for IDisposable types, supports reset/dispose. | DisposableSingleton | 1.0.0.0 | |
GenericSingleton | Thread-safe, generic singleton for any reference type. | GenericSingleton | 1.0.0.0 | |
MultiInstanceSingleton | Manages multiple singleton instances, each identified by a unique key. | MultiInstanceSingleton | 1.0.0.0 | |
ReadOnlySingleton | Singleton that is immutable after creation. | ReadOnlySingleton | 1.0.0.0 | |
ResettableSingleton | Singleton that can be explicitly reset. | ResettableSingleton | 1.0.0.0 | |
ScopedSingleton | Provides singleton instances per scope key. | ScopedSingleton | 1.0.0.0 | |
SingletonRegistry | Central registry for managing singleton instances by type. | SingletonRegistry | 1.0.0.0 | |
ThreadLocalSingleton | Singleton instance per thread. | ThreadLocalSingleton | 1.0.0.0 | |
WeakSingleton | Singleton with weak reference, allows GC if no strong refs exist. | WeakSingleton | 1.0.0.0 |
Development
- Clone or fork the repo
- Create a new branch
- Code!
- Push your changes and open a PR
- Once approved, they'll be merged in
- Profit!
Future Plans
See list of issues under the Milestones: https://github.com/vonderborch/Singletons.Net/milestones
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.