MethodInfo.ReturnType プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)


戻り値の型のプロパティを取得するには、初めに 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 */

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
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


_MethodInfo.ReturnType プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)



Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- _MethodInfo.ReturnTypeのページへのリンク