forked from needle-mirror/com.unity.xr.management
-
Notifications
You must be signed in to change notification settings - Fork 1
/
TypeLoaderExtensions.cs
36 lines (30 loc) · 958 Bytes
/
TypeLoaderExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEngine;
using UnityEngine.XR.Management;
namespace UnityEditor.XR.Management
{
internal static class TypeLoaderExtensions
{
public static TypeCache.TypeCollection GetTypesWithInterface<T>(this Assembly asm)
{
return TypeCache.GetTypesDerivedFrom(typeof(T));
}
public static TypeCache.TypeCollection GetAllTypesWithInterface<T>()
{
return TypeCache.GetTypesDerivedFrom(typeof(T));
}
public static TypeCache.TypeCollection GetTypesWithAttribute<T>(this Assembly asm)
{
return TypeCache.GetTypesWithAttribute(typeof(T));
}
public static TypeCache.TypeCollection GetAllTypesWithAttribute<T>()
{
return TypeCache.GetTypesWithAttribute(typeof(T));
}
}
}