System.Dynamic.Utils.TypeUtils.GetBooleanOperator C# (CSharp) Method

GetBooleanOperator() public static method

Searches for an operator method on the type. The method must have the specified signature, no generic arguments, and have the SpecialName bit set. Also searches inherited operator methods. NOTE: This was designed to satisfy the needs of op_True and op_False, because we have to do runtime lookup for those. It may not work right for unary operators in general.
public static GetBooleanOperator ( Type type, string name ) : MethodInfo
type Type
name string
return System.Reflection.MethodInfo
        public static MethodInfo GetBooleanOperator(Type type, string name)
        {
            do
            {
                MethodInfo result = type.GetAnyStaticMethodValidated(name, new Type[] { type });
                if (result != null && result.IsSpecialName && !result.ContainsGenericParameters)
                {
                    return result;
                }
                type = type.GetTypeInfo().BaseType;
            } while (type != null);
            return null;
        }