System.Xml.Xsl.Runtime.XmlExtensionFunction.CanBind C# (CSharp) Method

CanBind() public method

Return true if the CLR type specified in the Init() call has a matching method.
public CanBind ( ) : bool
return bool
        public bool CanBind() {
            MethodInfo[] methods = this.objectType.GetMethods(this.flags);
            bool ignoreCase = (this.flags & BindingFlags.IgnoreCase) != 0;
            StringComparison comparison = ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;

            // Find method in object type
            foreach (MethodInfo methSearch in methods) {
                if (methSearch.Name.Equals(this.name, comparison) && (this.numArgs == -1 || methSearch.GetParameters().Length == this.numArgs)) {
                    // Binding to generic methods will never succeed
                    if (!methSearch.IsGenericMethodDefinition)
                        return true;
                }
            }

            return false;
        }