private static void InitConfigAttributes() { FieldInfo[] fields = typeof(ContainerOptions).GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly); _configAttributes = new ArrayList(fields.Length); foreach (FieldInfo field in fields) { object[] attrs = field.GetCustomAttributes(typeof(ConfigElementAttribute), true); if (attrs.Length != 0) { ConfigElementAttribute attr = (ConfigElementAttribute)attrs[0]; attr.FieldInfo = field; _configAttributes.Add(attr); } } }
private static void InitConfigAttributes() { FieldInfo[] fields = typeof(CommonOptions).GetFields(BindingFlags.NonPublic | BindingFlags.Instance); _configAttributes = new ArrayList(fields.Length); bool language_found = false; foreach (FieldInfo field in fields) { object[] attrs = field.GetCustomAttributes(typeof(ConfigElementAttribute), true); if (attrs.Length != 0) { ConfigElementAttribute attr = (ConfigElementAttribute)attrs[0]; attr.FieldInfo = field; if (!language_found) { Debug.Assert(field.Name == "_language"); //Languageの初期値は実行時でないと決まらない (attr as ConfigEnumElementAttribute).InitialAsInt = (int)GUtil.CurrentLanguage; language_found = true; } _configAttributes.Add(attr); } } }