Gets the Type of this parameter. : ParameterInfo « Reflection « C# / C Sharp






Gets the Type of this parameter.

  
 using System;
 using System.Reflection;

 class parminfo
 {
    public static void mymethod (int int1m, out string str2m, ref string str3m)
    {
       str2m = "asdf";
    }

    public static int Main(string[] args)
    {
       Type Mytype = Type.GetType("parminfo");
       MethodBase Mymethodbase = Mytype.GetMethod("mymethod");
       Console.Write("\nMymethodbase = " + Mymethodbase);
       ParameterInfo[]Myarray = Mymethodbase.GetParameters();
       foreach (ParameterInfo Myparam in Myarray)
       {
          Console.Write ("\nFor parameter # " + Myparam.Position 
             + ", the ParameterType is - " + Myparam.ParameterType);
       }
       return 0;
    }
 }

   
    
  








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 the attributes for this parameter.
6.Gets all the custom attributes defined on this parameter.
7.If attribute of the type or its derived types is applied
8.Gets a value indicating whether this is an output parameter.
9.Gets the name of the parameter.
10.Append Generic Type parameters to StringBuilder