fork(10) download
  1. using System;
  2. using System.Globalization;
  3. using System.Linq;
  4. using System.Collections.Generic;
  5. using System.Reflection;
  6.  
  7. public class Test
  8. {
  9. class Entity { }
  10. class Item : Entity { }
  11. class Actor : Entity { }
  12.  
  13. public static void Main()
  14. {
  15. int iterations = 10;
  16. Type pType = typeof(Entity);
  17. var children = Enumerable.Range(1, iterations)
  18. .SelectMany(i => Assembly.GetExecutingAssembly().GetTypes()
  19. .Where(t => t.IsClass
  20. && pType.IsAssignableFrom(t) && t != pType)
  21. .Select(t => t.Name));
  22. var all = string.Join(",", children.ToArray());
  23. Console.Write(all);
  24. }
  25. }
Success #stdin #stdout 0.04s 34064KB
stdin
Standard input is empty
stdout
Item,Actor,Item,Actor,Item,Actor,Item,Actor,Item,Actor,Item,Actor,Item,Actor,Item,Actor,Item,Actor,Item,Actor