System.Dynamic.Utils.TypeExtensions.GetAnyStaticMethodValidated C# (CSharp) Method

GetAnyStaticMethodValidated() public static method

Returns the matching method if the parameter types are reference assignable from the provided type arguments, otherwise null.
public static GetAnyStaticMethodValidated ( this type, string name, Type types ) : MethodInfo
type this
name string
types Type
return System.Reflection.MethodInfo
        public static MethodInfo GetAnyStaticMethodValidated(this Type type, string name, Type[] types)
        {
            foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly))
            {
                if (method.Name == name && method.MatchesArgumentTypes(types))
                {
                    return method;
                }
            }
            return null;
        }