Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetCompatibleGenericInterface()

static Type System.Text.Json.Reflection.ReflectionExtensions.GetCompatibleGenericInterface ( this Type type,
Type interfaceType )
inlinestatic

Definition at line 36 of file ReflectionExtensions.cs.

37 {
38 Type type2 = type;
39 if (type2.IsGenericType)
40 {
41 type2 = type2.GetGenericTypeDefinition();
42 }
43 if (type2 == interfaceType)
44 {
45 return type;
46 }
47 Type[] interfaces = type.GetInterfaces();
48 foreach (Type type3 in interfaces)
49 {
50 if (type3.IsGenericType)
51 {
52 Type genericTypeDefinition = type3.GetGenericTypeDefinition();
54 {
55 return type3;
56 }
57 }
58 }
59 return null;
60 }

References System.Text.Json.Dictionary, System.Type.GetInterfaces(), and System.type.