public static int GetMethodGenerity(IMethod method) { IConstructedMethodInfo constructedInfo = method.ConstructedInfo; if (constructedInfo != null) { return(constructedInfo.GenericArguments.Length); } IGenericMethodInfo genericInfo = method.GenericInfo; if (genericInfo != null) { return(genericInfo.GenericParameters.Length); } return(0); }
protected static IInternalEntity GetConstructedInternalEntity(IEntity entity) { IConstructedMethodInfo constructedMethod = entity as IConstructedMethodInfo; if (null != constructedMethod) { entity = constructedMethod.GenericDefinition; } IConstructedTypeInfo constructedType = entity as IConstructedTypeInfo; if (null != constructedType) { entity = constructedType.GenericDefinition; } return(entity as IInternalEntity); }
/// <summary> /// Retrieves the MethodInfo for a generic constructed method. /// </summary> private MethodInfo GetConstructedMethodInfo(IConstructedMethodInfo constructedInfo) { Type[] arguments = Array.ConvertAll<IType, Type>( constructedInfo.GenericArguments, GetSystemType); return GetMethodInfo(constructedInfo.GenericDefinition).MakeGenericMethod(arguments); }