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 ()
public function get ReturnType () : Type
속성 값
이 메서드의 반환 형식입니다.
설명
반환 형식 속성을 가져오려면 먼저 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에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
2.0, 1.1, 1.0에서 지원
.NET Compact Framework
2.0, 1.0에서 지원