Class TypeExtension
- Namespace
- Xarial.XToolkit.Reflection
- Assembly
- BlueByte.SOLIDWORKS.PDMProfessional.SDK.dll
public static class TypeExtension
- Inheritance
-
TypeExtension
- Inherited Members
Methods
FindMethod(Type, string, BindingFlags)
public static MethodInfo FindMethod(this Type type, string methodName, BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
Parameters
type
TypemethodName
stringflags
BindingFlags
Returns
GetArgumentsOfGenericType(Type, Type)
public static Type[] GetArgumentsOfGenericType(this Type thisType, Type genericType)
Parameters
Returns
- Type[]
GetEnumFlags(Type)
public static Enum[] GetEnumFlags(this Type enumType)
Parameters
enumType
Type
Returns
- Enum[]
GetMethodWithGenericParameters(Type, string, Type[], BindingFlags)
Finds the method from the type if
public static MethodInfo GetMethodWithGenericParameters(this Type type, string name, Type[] paramTypes, BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public)
Parameters
type
TypeType to get method from
name
stringName of the method
paramTypes
Type[]Parameter types of the method
bindingFlags
BindingFlagsBinding flags
Returns
- MethodInfo
Method or null if not found
Remarks
This method is similar to GetMethod(string), but allowing to specify the generic types definitions
InvokeMethod(object, MethodInfo, params object[])
public static void InvokeMethod(object obj, MethodInfo method, params object[] args)
Parameters
obj
objectmethod
MethodInfoargs
object[]
InvokeMethod<TRes>(object, MethodInfo, params object[])
public static TRes InvokeMethod<TRes>(object obj, MethodInfo method, params object[] args)
Parameters
obj
objectmethod
MethodInfoargs
object[]
Returns
- TRes
Type Parameters
TRes
IsAssignableToGenericType(Type, Type)
Checks if this type can be assigned to the generic type
public static bool IsAssignableToGenericType(this Type thisType, Type genericType)
Parameters
Returns
- bool
True if this type can be assigned to generic type
TryFindGenericType(Type, Type)
public static Type TryFindGenericType(this Type thisType, Type genericType)
Parameters
Returns
TryGetAttribute<TAtt>(Type, out TAtt, bool)
public static bool TryGetAttribute<TAtt>(this Type type, out TAtt att, bool searchInParentTypes = false) where TAtt : Attribute
Parameters
Returns
Type Parameters
TAtt