_MethodInfo.ReturnTypeとは? わかりやすく解説

MethodInfo.ReturnType プロパティ

このメソッド戻り値の型を取得します

名前空間: System.Reflection
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Overridable ReadOnly
 Property ReturnType As Type
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 ()

プロパティ
このメソッド戻り値の型。

解説解説

戻り値の型のプロパティ取得するには、初めに Type クラス取得します。そして、その Type から MethodInfo取得します。そして、その MethodInfo から ReturnType取得します

使用例使用例

指定したメソッド戻り値の型を表示する例を次に示します

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
*/
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

_MethodInfo.ReturnType プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

COM オブジェクトに、ReturnType プロパティへのバージョン依存しないアクセス用意されています。

このプロパティは、CLS準拠していません。  

名前空間: System.Runtime.InteropServices
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim instance As _MethodInfo
Dim value As Type

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

プロパティ
このメソッド戻り値の型。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
_MethodInfo インターフェイス
_MethodInfo メンバ
System.Runtime.InteropServices 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「_MethodInfo.ReturnType」の関連用語

_MethodInfo.ReturnTypeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



_MethodInfo.ReturnTypeのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS