MethodInfo.ReturnType Property
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Gets the return type of this method.
Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Overridable ReadOnly Property ReturnType As Type
public virtual Type ReturnType { get; }
Property Value
Type: System.Type
The return type of this method.
Remarks
To get the return type property, first get the class Type. From the Type, get the MethodInfo. From the MethodInfo, get the ReturnType.
Examples
The following example displays the return type of the specified method.
Note: |
---|
To run this example, see Building Examples That Use a Demo Method and a TextBlock Control. |
Imports System.Reflection
Class Example
Public Shared Function Demo(ByVal outputBlock As System.Windows.Controls.TextBlock) As Integer
outputBlock.Text &= ControlChars.Cr + "Reflection.MethodInfo" & vbCrLf
'Get the Type and MethodInfo.
Dim MyType As Type = Type.GetType("System.Reflection.FieldInfo")
Dim Mymethodinfo As MethodInfo = MyType.GetMethod("GetValue")
outputBlock.Text += ControlChars.Cr _
+ MyType.FullName + "." + Mymethodinfo.Name
'Get and display the ReturnType.
outputBlock.Text += String.Format(ControlChars.Cr _
+ "ReturnType = {0}", Mymethodinfo.ReturnType)
Return 0
End Function
End Class
using System;
using System.Reflection;
class Example
{
public static int Demo(System.Windows.Controls.TextBlock outputBlock)
{
outputBlock.Text += "\nReflection.MethodInfo" + "\n";
// Get the Type and MethodInfo.
Type MyType = Type.GetType("System.Reflection.FieldInfo");
MethodInfo Example = MyType.GetMethod("GetValue");
outputBlock.Text += "\n" + MyType.FullName + "." + Example.Name;
// Get and display the ReturnType.
outputBlock.Text += String.Format("\nReturnType = {0}", Example.ReturnType);
return 0;
}
}
Version Information
Silverlight
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
XNA Framework
Supported in: Xbox 360, Windows Phone OS 7.0
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.