Skip to content

Repository files navigation

SingletonSourceGenerator

This source generator helps you to automatically implement a singleton pattern. To use this, simply add [Singleton] attribute to your partial class.

using SingletonSourceGenerator.Attributes;

namespace MyNamespace;

[Singleton]
public partial class MyClass{
}

This will generate

namespace MyNamespace;

partial class MyClass{
	private static MyClass? instance;
	public static MyClass Instance => instance ??= new();
}

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages