design-patterns/Singleton/SimpleSingleton.cs
2023-09-04 11:29:51 +01:00

18 lines
394 B
C#

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; }
}