C# MethodInfo ReturnType

Description

MethodInfo ReturnType Gets the return type of this method.

Syntax

MethodInfo.ReturnType has the following syntax.


public virtual Type ReturnType { get; }

Example

The following example displays the return type of the specified method.


//w  ww.  ja  va 2s  .c  om
using System;
using System.Reflection;

class Mymethodinfo
{
    public static int Main()
    {
        Type MyType = Type.GetType("System.Reflection.FieldInfo");
        MethodInfo Mymethodinfo = MyType.GetMethod("GetValue");
        Console.Write ("\n" + MyType.FullName + "." + Mymethodinfo.Name);
        Console.Write ("\nReturnType = {0}", Mymethodinfo.ReturnType);
        return 0;
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo