design-patterns/Singleton/SimpleSingleton.cs

19 lines
394 B
C#
Raw Permalink Normal View History

2023-09-04 10:29:51 +00:00
public sealed class SimpleSingleton
{
private SimpleSingleton() { }
private static SimpleSingleton _instance;
public static SimpleSingleton GetInstance(string value)
{
if (_instance == null)
{
_instance = new SimpleSingleton();
_instance.Value = value;
}
return _instance;
}
public string Value { get; set; }
}