本文整理汇总了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));
}
示例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);
}
示例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);
}
}
示例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));
}
示例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));
}
示例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);
}
示例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);
}