private static void initializeType(Type t) { if (!t.IsSubclassOf(typeof(Enumerated <>))) { return; } FieldInfo[] fields = t.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Static | BindingFlags.Public); if ((int)fields.Length > 0) { fields[0].GetValue(null); } EnumeratedRepository <T> .initializeType(t.BaseType); }
static EnumeratedRepository() { EnumeratedRepository <T> ._inner = new Dictionary <string, IEnumerated>(StringComparer.Ordinal); EnumeratedRepository <T> .initializeType(typeof(T)); }