Gets the attributes for this parameter.
using System;
using System.Reflection;
public class MyClass1
{
public int MyMethod( int i, out short j, ref long k)
{
j = 2;
return 0;
}
}
public class MainClass
{
public static void Main()
{
Type myType = typeof(MyClass1);
MethodBase myMethodBase = myType.GetMethod("MyMethod");
ParameterInfo[] myParameters = myMethodBase.GetParameters();
Console.WriteLine(myParameters.Length);
for(int i = 0; i < myParameters.Length; i++)
Console.WriteLine(myParameters[i].Attributes);
}
}
Related examples in the same category