using System.Collections.Generic;
public static void Main()
public static class Manager
List<string> validIDs = new List<string>();
List<Type> containers = new List<Type>{typeof(Container)};
foreach(var cont in containers)
MemberInfo[] members = cont.GetMembers(BindingFlags.Static | BindingFlags.Public);
foreach(var mb in members)
FieldInfo field = cont.GetField(mb.Name);
if(field.FieldType.BaseType == typeof(BaseClass))
var instance = (BaseClass)field.GetValue(null);
Console.WriteLine(String.Join(",", validIDs));
public static void Go(){}
public abstract class BaseClass
public abstract string ID { get; }
public class MyClass : BaseClass
public override string ID { get { return "MyClass"; } }
public class YourClass : BaseClass
public override string ID { get { return "YourClass"; } }
internal static class Container
public static readonly MyClass Option1 = new MyClass();
public static readonly YourClass Option2 = new YourClass();