Retrieves the Type of this parameter.
[Visual Basic] Overridable Public ReadOnly Property ParameterType As Type [C#] public Type ParameterType {virtual get;} [C++] public: __property virtual Type* get_ParameterType(); [JScript] public function get ParameterType() : Type;
Read-only. Retrieves the Type object that represents the Type of this parameter.
Retrieves the class that represents the type of the parameter.
This method utilizes the ClassImpl method.
This method depends on an optional metadata and may not be available in all compilers.
To get the ParameterInfo array, first get the method. From the method, get the Type. From the Type, get the ParameterInfo array.
[C++] class parminfo { public static void mymethod ( [in] int int1m, out string str2m, ref string str3m) { str2m = "in mymethod"; } public static int Main(string[] args) { Console.WriteLine("\nReflection.Parameterinfo"); //Get the ParameterInfo parameter of a function. //Get the type Type Mytype = Type.GetType("parminfo"); //Get and display the method MethodBase Mymethodbase = Mytype.GetMethod("mymethod"); Console.Write("\nMymethodbase = " + Mymethodbase); //Get the ParameterInfo array ParameterInfo[]Myarray = Mymethodbase.GetParameters(); //Get and display the ParameterInfo of each parameter foreach (ParameterInfo Myparam in Myarray) { Console.Write ("\nFor parameter # " + Myparam.Position + ", the ParameterType is - " + Myparam.ParameterType); } return 0; } } Produces the following output Reflection.Parameterinfo Mymethodbase = Void mymethod (Int32, System.String ByRef, System.String ByRef) For parameter # 0, the ParameterType is - Int32 For parameter # 1, the ParameterType is - System.String For parameter # 2, the ParameterType is - System.String
ParameterInfo Class | ParameterInfo Members | System.Reflection Namespace