Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

MethodInfo.ReturnType Property

Gets the return type of this method.

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)

public virtual Type ReturnType { get; }
/** @property */
public Type get_ReturnType ()

public function get ReturnType () : Type

Property Value

The return type of this method.

To get the return type property, first get the class Type. From the Type, get the MethodInfo. From the MethodInfo, get the ReturnType.

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

using System;
using System.Reflection;

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

import System.*;
import System.Reflection.*;

class MyMethodInfo
    public static void main(String[] args)

        // Get the Type and MethodInfo.
        Type myType = Type.GetType("System.Reflection.FieldInfo");
        MethodInfo myMethodInfo = myType.GetMethod("GetValue");

        Console.Write(("\n" + myType.get_FullName() + "." 
            + myMethodInfo.get_Name()));

        // Get and display the ReturnType.
        Console.Write("\nReturnType = {0}", myMethodInfo.get_ReturnType());
    } //main
} //MyMethodInfo

class Mymethodinfo
   public static function Main() : void
      Console.WriteLine ("\nReflection.MethodInfo");
      //Get the Type and MethodInfo.
      var MyType : Type = Type.GetType("System.Reflection.FieldInfo");
      var Mymethodinfo : MethodInfo = MyType.GetMethod("GetValue");
      Console.Write ("\n" + MyType.FullName + "." + Mymethodinfo.Name);
      //Get and display the ReturnType.
      Console.Write ("\nReturnType = {0}", Mymethodinfo.ReturnType);
This code produces the following output:

ReturnType - System.Object

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

© 2017 Microsoft