Freigeben über


MethodInfo.ReturnType-Eigenschaft

Ruft den Rückgabetyp dieser Methode ab.

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

Syntax

'Declaration
Public Overridable ReadOnly Property ReturnType As Type
'Usage
Dim instance As MethodInfo
Dim value As Type

value = instance.ReturnType
public virtual Type ReturnType { get; }
public:
virtual property Type^ ReturnType {
    Type^ get ();
}
/** @property */
public Type get_ReturnType ()
public function get ReturnType () : Type

Eigenschaftenwert

Der Rückgabetyp dieser Methode.

Hinweise

Um die Rückgabetyp-Eigenschaft abzurufen, rufen Sie zunächst den Type der Klasse ab. Über Type rufen Sie MethodInfo ab. Über MethodInfo rufen Sie ReturnType ab.

Beispiel

Im folgenden Beispiel wird der Rückgabetyp der angegebenen Methode angezeigt.

Imports System
Imports System.Reflection
Imports Microsoft.VisualBasic

Class Mymethodinfo1

    Public Shared Function Main() As Integer
        Console.WriteLine(ControlChars.Cr + "Reflection.MethodInfo")

        'Get the Type and MethodInfo.
        Dim MyType As Type = Type.GetType("System.Reflection.FieldInfo")
        Dim Mymethodinfo As MethodInfo = MyType.GetMethod("GetValue")
        Console.Write(ControlChars.Cr _
           + MyType.FullName + "." + Mymethodinfo.Name)

        'Get and display the ReturnType.
        Console.Write(ControlChars.Cr _
           + "ReturnType = {0}", Mymethodinfo.ReturnType)
        Return 0
    End Function
End Class
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;
    }
}
using namespace System;
using namespace System::Reflection;
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{0}.{1}", 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)
    {
        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.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);
   }
}
Mymethodinfo.Main();
/*
This code produces the following output:

Reflection.MethodInfo
System.Reflection.FieldInfo.GetValue
ReturnType - System.Object
*/

Plattformen

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

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

MethodInfo-Klasse
MethodInfo-Member
System.Reflection-Namespace