Is this a good definition for singleton?

internal static class Singleton<T> where T : new() { private static readonly ConcurrentDictionary<Type, T> instances = new ConcurrentDictionary<Type, T>(); public static T Instance { get; } = instances.GetOrAdd(typeof(T), t => new T()); } 

submitted by /u/mycall
[link] [comments]

Leave a Reply