当前位置: 首页>>代码示例>>C#>>正文


C# System.Reflection.MethodInfo.GetParameters方法代码示例

本文整理汇总了C#中System.Reflection.MethodInfo.GetParameters方法的典型用法代码示例。如果您正苦于以下问题:C# System.Reflection.MethodInfo.GetParameters方法的具体用法?C# System.Reflection.MethodInfo.GetParameters怎么用?C# System.Reflection.MethodInfo.GetParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Reflection.MethodInfo的用法示例。


在下文中一共展示了System.Reflection.MethodInfo.GetParameters方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessParams

 public override bool ProcessParams(MethodInfo method, int paramNum, IFacetHolder holder) {
     ParameterInfo parameter = method.GetParameters()[paramNum];
     Attribute attribute = parameter.GetCustomAttributeByReflection<DescriptionAttribute>();
     if (attribute == null) {
         attribute = parameter.GetCustomAttributeByReflection<DescribedAsAttribute>();
     }
     return FacetUtils.AddFacet(Create(attribute, holder));
 }
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:8,代码来源:DescribedAsAnnotationFacetFactory.cs

示例2: Process

        public override bool Process(MethodInfo actionMethod, IMethodRemover methodRemover, IFacetHolder action) {
            string capitalizedName = NameUtils.CapitalizeName(actionMethod.Name);

            Type type = actionMethod.DeclaringType;
            var facets = new List<IFacet>();
            INakedObjectSpecification onType = Reflector.LoadSpecification(type);
            INakedObjectSpecification returnSpec = Reflector.LoadSpecification(actionMethod.ReturnType);

            RemoveMethod(methodRemover, actionMethod);
            facets.Add(new ActionInvocationFacetViaMethod(actionMethod, onType, returnSpec, action));

            MethodType methodType = actionMethod.IsStatic ? MethodType.Class : MethodType.Object;
            Type[] paramTypes = actionMethod.GetParameters().Select(p => p.ParameterType).ToArray();
            FindAndRemoveValidMethod(facets, methodRemover, type, methodType, capitalizedName, paramTypes, action);

            DefaultNamedFacet(facets, capitalizedName, action); // must be called after the checkForXxxPrefix methods

            AddHideForSessionFacetNone(facets, action);
            AddDisableForSessionFacetNone(facets, action);
            FindDefaultHideMethod(facets, methodRemover, type, methodType, "ActionDefault", paramTypes, action);
            FindAndRemoveHideMethod(facets, methodRemover, type, methodType, capitalizedName, paramTypes, action);
            FindDefaultDisableMethod(facets, methodRemover, type, methodType, "ActionDefault", paramTypes, action);
            FindAndRemoveDisableMethod(facets, methodRemover, type, methodType, capitalizedName, paramTypes, action);

            if (action is DotNetNakedObjectActionPeer) {
                var nakedObjectActionPeer = (DotNetNakedObjectActionPeer) action;
                // Process the action's parameters names, descriptions and optional
                // an alternative design would be to have another facet factory processing just ActionParameter, and have it remove these
                // supporting methods.  However, the FacetFactory API doesn't allow for methods of the class to be removed while processing
                // action parameters, only while processing Methods (ie actions)
                INakedObjectActionParamPeer[] actionParameters = nakedObjectActionPeer.Parameters;
                string[] paramNames = actionMethod.GetParameters().Select(p => p.Name).ToArray();

                FindAndRemoveParametersAutoCompleteMethod(methodRemover, type, capitalizedName, paramTypes, actionParameters);
                FindAndRemoveParametersChoicesMethod(methodRemover, type, capitalizedName, paramTypes, paramNames, actionParameters);
                FindAndRemoveParametersDefaultsMethod(methodRemover, type, capitalizedName, paramTypes, paramNames, actionParameters);
                FindAndRemoveParametersValidateMethod(methodRemover, type, capitalizedName, paramTypes, paramNames, actionParameters);
            }
            return FacetUtils.AddFacets(facets);
        }
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:40,代码来源:ActionMethodsFacetFactory.cs

示例3: DisplayMethodProperties

        public void DisplayMethodProperties(System.Reflection.MethodInfo Method)
        {
            ThisMethod = Method;

            // Show the method name

            Label2.Text = ThisMethod.Name;

            // Show the calling convention

            Label4.Text = "0x" + ThisMethod.CallingConvention.ToString("x") +
                " = " + ThisMethod.CallingConvention.ToString();

            // Show the method's standard attributes

            Label6.Text = "0x" + ThisMethod.Attributes.ToString("x") +
                " = " + ThisMethod.Attributes.ToString();

            // Show the return type

            Label8.Text = ThisMethod.ReturnType.FullName;

            // Show the parameters

            foreach (System.Reflection.ParameterInfo parm in ThisMethod.GetParameters())
            {
                //ListBox1.Items.Add(parm.Name + " as " + parm.ParameterType.FullName);
                ListBox1.Items.Add(parm.ParameterType);//changed because I need the type later
            }

            // Show the custom attributes

            foreach (object attr in ThisMethod.GetCustomAttributes(true))
            {
                ListBox2.Items.Add(attr);
            }
        }
开发者ID:dust2098,项目名称:e33-dispatcher-application,代码行数:37,代码来源:frmDisplayMethod.cs

示例4: ProcessParams

 public override bool ProcessParams(MethodInfo method, int paramNum, IFacetHolder holder) {
     ParameterInfo parameter = method.GetParameters()[paramNum];
     var attribute = parameter.GetCustomAttributeByReflection<PresentationHintAttribute>();
     return FacetUtils.AddFacet(Create(attribute, holder));
 }
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:5,代码来源:PresentationHintAnnotationFacetFactory.cs

示例5: ProcessParams

 public override bool ProcessParams(MethodInfo method, int paramNum, IFacetHolder holder) {
     ParameterInfo parameter = method.GetParameters()[paramNum];
     Attribute attribute = parameter.GetCustomAttributeByReflection<DisplayNameAttribute>() ?? (Attribute) parameter.GetCustomAttributeByReflection<NamedAttribute>();
     return FacetUtils.AddFacet(Create(attribute, holder));
 }
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:5,代码来源:NamedAnnotationFacetFactory.cs

示例6: ProcessParams

        public override bool ProcessParams(MethodInfo method, int paramNum, IFacetHolder holder) {
            ParameterInfo parameter = method.GetParameters()[paramNum];
            var attribute = parameter.GetCustomAttributeByReflection<EnumDataTypeAttribute>();

            return AddEnumFacet(attribute, holder, parameter.ParameterType);
        }
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:6,代码来源:EnumFacetFactory.cs

示例7: ProcessParams

        public override bool ProcessParams(MethodInfo method, int paramNum, IFacetHolder holder) {
            ParameterInfo parameter = method.GetParameters()[paramNum];
            IFacet facet = null;

            if (parameter.ParameterType.IsGenericType && (parameter.ParameterType.GetGenericTypeDefinition() == typeof (Nullable<>))) {
                facet = new NullableFacetAlways(holder);
            }

            return FacetUtils.AddFacet(facet);
        }
开发者ID:radi4music,项目名称:NakedObjectsFramework,代码行数:10,代码来源:ActionMethodsFacetFactory.cs


注:本文中的System.Reflection.MethodInfo.GetParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。