MethodReference InflateMethod(TypeReference inflatedDeclaringType, MethodDefinition openMethod) { var git = inflatedDeclaringType as GenericInstanceType; if (git == null) { return(openMethod); } var inflatedReturnType = TypeReferenceExtensions.InflateGenericType(git, openMethod.ReturnType); var mr = new MethodReference(openMethod.Name, inflatedReturnType, git); if (openMethod.HasParameters) { for (int i = 0; i < openMethod.Parameters.Count; i++) { var inflatedParameterType = TypeReferenceExtensions.InflateGenericType(git, openMethod.Parameters [i].ParameterType); var p = new ParameterDefinition(openMethod.Parameters [i].Name, openMethod.Parameters [i].Attributes, inflatedParameterType); mr.Parameters.Add(p); } } return(mr); }
public static bool IsValueType(this TypeReference typeReference) => TypeReferenceExtensions.IsValueType(typeReference);
public static bool TypeImplements(this TypeReference typeReference, Type interfaceType) => TypeReferenceExtensions.TypeImplements(typeReference, interfaceType);
public bool TestInheritsFromOrImplements(Type typeRef, Type baseClass) { return(TypeReferenceExtensions.InheritsFromOrImplements(module.ImportReference(typeRef), module.ImportReference(baseClass))); }