/// <summary> /// Returns all methods matching the identifier. /// </summary> /// <param name="type">The type to search the methods in.</param> /// <param name="identifier">The identifier to match the methods.</param> public MethodBinding[] FindMethod(Type type, Identifier identifier) { if (type == null) { throw ExceptionBuilder.ArgumentNull("type"); } if (identifier == null) { throw ExceptionBuilder.ArgumentNull("identifier"); } // Get method provider responsible for the given type. IMethodProvider methodProvider = _methodProviders[type]; if (methodProvider == null) { return(new MethodBinding[0]); } // Get properties from the provider. MethodBinding[] methods; try { methods = methodProvider.GetMethods(type); } catch (NQueryException) { throw; } catch (Exception ex) { throw ExceptionBuilder.IMethodProviderGetMethodsFailed(ex); } // Return all methods that match the given name. List <MethodBinding> result = new List <MethodBinding>(); foreach (MethodBinding methodBinding in methods) { if (identifier.Matches(methodBinding.Name)) { result.Add(methodBinding); } } return(result.ToArray()); }