using System; using System.Collections.Generic; namespace NBF { public static class Configs { private static readonly Dictionary _dictionary = new Dictionary(); static Configs() { } public static ConfigContext Table() where T : ConfigBase { var type = typeof(T); if (_dictionary.TryGetValue(type, out var context)) { return context as ConfigContext; } var jsonContext = new ConfigContext(); _dictionary[type] = jsonContext; return jsonContext; } } }