public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) { var methodName = binder.Name; var typesParameters = AllMethodsForName.GetTypesParameters(args); var obj = _wrap.IsType ? null : _wrap.Object; var type = _wrap.Type; var isStatic = _wrap.IsType; if (ExecuteGenericMethod(obj, type, methodName, isStatic, _arguments, typesParameters, args, out result)) { return(true); } // Проверим методы расширения if (!isStatic) { if (ExtensionMethod.ExecuteExtensionMethodGenericType(obj, methodName, _arguments, typesParameters, args, out result)) { return(true); } } return(false); }
public AllMethodsForName FindAllMethodByName(string methodName) { CheckForSynonym(ref methodName); if (!Methods.TryGetValue(methodName, out var methods)) { var methodInfos = _type.GetTypeInfo().GetMethods().Where(x => x.Name == methodName).ToArray(); if (methodInfos.Length == 0) { return(null); } methods = new AllMethodsForName(methodInfos); Methods[methodName] = methods; } return(methods); }