Snippet: Singleton class

property value
IDE Visual Studio
Language C#
Title Singleton class
Shortcut c_
Description class that implements singleton pattern
Snippet Types Expansion

Placeholders

Identifier Tooltip Default Value Editable Function Type Name
modifier Modifier(s) public sealed yes
name Class name ClassName yes
value Value to assign value yes

Code

public sealed class ClassName {
	private static readonly ClassName _instance = value;

	private ClassName() {
	}

	public static ClassName Instance {
		get { return _instance; }
	}
}