TypeLoaderExtensions.cs 958 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Reflection;
  6. using UnityEditor;
  7. using UnityEngine;
  8. using UnityEngine.XR.Management;
  9. namespace UnityEditor.XR.Management
  10. {
  11. internal static class TypeLoaderExtensions
  12. {
  13. public static TypeCache.TypeCollection GetTypesWithInterface<T>(this Assembly asm)
  14. {
  15. return TypeCache.GetTypesDerivedFrom(typeof(T));
  16. }
  17. public static TypeCache.TypeCollection GetAllTypesWithInterface<T>()
  18. {
  19. return TypeCache.GetTypesDerivedFrom(typeof(T));
  20. }
  21. public static TypeCache.TypeCollection GetTypesWithAttribute<T>(this Assembly asm)
  22. {
  23. return TypeCache.GetTypesWithAttribute(typeof(T));
  24. }
  25. public static TypeCache.TypeCollection GetAllTypesWithAttribute<T>()
  26. {
  27. return TypeCache.GetTypesWithAttribute(typeof(T));
  28. }
  29. }
  30. }