/// <summary> /// Get the method with the specified name and parameter types. /// </summary> public override MethodRef GetMethod(string name, params TypeRefBase[] parameterTypes) { // Look for the method in the type declaration MethodDeclBase found = GetMethod <MethodDeclBase>(name, parameterTypes); if (found != null) { return((MethodRef)found.CreateRef()); } // Look for the method in any base types List <Expression> baseTypes = GetAllBaseTypes(); if (baseTypes != null) { foreach (Expression baseTypeExpression in baseTypes) { TypeRef typeRef = baseTypeExpression.SkipPrefixes() as TypeRef; if (typeRef != null) { MethodRef methodRef = typeRef.GetMethod(name, parameterTypes); if (methodRef != null) { return(methodRef); } } } } // Finally, look for the method in the 'object' base type return(TypeRef.ObjectRef.GetMethod(name, parameterTypes)); }
/// <summary> /// Get the method with the specified name and parameter types. /// </summary> public virtual MethodRef GetMethod(string name, params TypeRefBase[] parameterTypes) { MethodDeclBase found = GetMethod <MethodDeclBase>(name, parameterTypes); if (found != null) { return((MethodRef)found.CreateRef()); } TypeRef baseRef = GetBaseType(); return(baseRef != null ? baseRef.GetMethod(name, parameterTypes) : null); }