wbc
9 天以前 94d0b18fa47a92a1cb4d1fef4520d35ef2c2c322
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
namespace Gs.Toolbox.ApiCore.Common.Inject;
 
public static class InjectTypeChecker
{
    private static readonly InjectTypeContext context = new();
 
    public static bool IsImplementInjectType(Type[] types)
    {
        foreach (var t in types)
            if (context.types.Contains(t))
                return true;
        return false;
    }
 
    public static bool IsImplementInjectType(Type type)
    {
        return context.types.Contains(type);
    }
 
    public static bool IsImplementInjectType(Type[] types, out Type type)
    {
        type = null;
        foreach (var t in types)
            if (context.types.Contains(t))
            {
                type = t;
                return true;
            }
 
        return false;
    }
}