RosettaCodeData/Task/Singleton/C-sharp/singleton-5.cs

7 lines
241 B
C#
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
public sealed class Singleton5 //Lazy: Yes ||| Thread-safe: Yes ||| Uses locking: No
{
private static readonly Lazy<Singleton5> lazy = new Lazy<Singleton5>(() => new Singleton5());
public static Singleton5 Instance => lazy.Value;
}