C# ParameterInfo ParameterType

Description

ParameterInfo ParameterType Gets the Type of this parameter.

Syntax

ParameterInfo.ParameterType has the following syntax.


public virtual Type ParameterType { get; }

Example


using System;/*  w  w  w . j ava 2s. c om*/
using System.Reflection;

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

    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;
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo