Gets the attributes for this parameter. : ParameterInfo « Reflection « C# / C Sharp






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

1.ParameterInfo: GetParameters
2.Dumping the methods and their parameters for a class.
3.Dumps the properties names and current values from an object type (used for static classes)
4.Dumps the properties names and current values from an object
5.Gets all the custom attributes defined on this parameter.
6.If attribute of the type or its derived types is applied
7.Gets a value indicating whether this is an output parameter.
8.Gets the name of the parameter.
9.Gets the Type of this parameter.
10.Append Generic Type parameters to StringBuilder