AppDomainExtension.cs 496 B

1234567891011121314151617181920212223242526
  1. using System.Collections.Generic;
  2. using System.Collections;
  3. using System;
  4. namespace GraphProcessor
  5. {
  6. public static class AppDomainExtension
  7. {
  8. public static IEnumerable< Type > GetAllTypes(this AppDomain domain)
  9. {
  10. foreach (var assembly in domain.GetAssemblies())
  11. {
  12. Type[] types = {};
  13. try {
  14. types = assembly.GetTypes();
  15. } catch {
  16. //just ignore it ...
  17. }
  18. foreach (var type in types)
  19. yield return type;
  20. }
  21. }
  22. }
  23. }