MethodInfo.ReturnType プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
このメソッドの戻り値の型を取得します。
public:
virtual property Type ^ ReturnType { Type ^ get(); };
public:
abstract property Type ^ ReturnType { Type ^ get(); };
public virtual Type ReturnType { get; }
public abstract Type ReturnType { get; }
member this.ReturnType : Type
Public Overridable ReadOnly Property ReturnType As Type
Public MustOverride ReadOnly Property ReturnType As Type
プロパティ値
このメソッドの戻り値の型。
実装
例
次の例では、指定したメソッドの戻り値の型を表示します。
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;
}
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;
}
}
Imports System.Reflection
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
注釈
戻り値の型プロパティを取得するには、まず クラス Type
を取得します。 から、 Type
を取得します MethodInfo
。 から、 MethodInfo
を取得します ReturnType
。
適用対象
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET