コード例 #1
0
        private MethodInfo GetMethod(string methodName)
        {
            List <MethodInfo> methods = ControllerType
                                        .GetMember(methodName, MemberTypes.Method, BindingFlags.Instance |
                                                   BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.IgnoreCase)
                                        .Cast <MethodInfo>()
                                        .Where(m => IsActionMethod(m, false))
                                        .ToList();

            switch (methods.Count)
            {
            case 0:
                return(null);

            case 1:
                return(methods[0]);

            default:
                throw Error.AmbiguousActionName(ControllerType, methodName);
            }
        }