Поделиться через


DynamicMethod.ReflectedType Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the class that was used in reflection to obtain the method.

Namespace:  System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Overrides ReadOnly Property ReflectedType As Type
public override Type ReflectedType { get; }

Property Value

Type: System.Type
Always nulla null reference (Nothing in Visual Basic).

Remarks

This property always returns nulla null reference (Nothing in Visual Basic) for dynamic methods.

Examples

The following code example displays the reflected type of a dynamic method. This code example is part of a larger example provided for the DynamicMethod class.

' For dynamic methods, the reflected type is always Nothing.
If hello.ReflectedType Is Nothing Then
   outputBlock.Text &= "ReflectedType is Nothing." & vbLf
Else
   outputBlock.Text &= String.Format("ReflectedType: {0}", _
       hello.ReflectedType) &vbLf
End If
// For dynamic methods, the reflected type is always null.
if (hello.ReflectedType == null)
{
   outputBlock.Text += "ReflectedType is null." + "\n";
}
else
{
   outputBlock.Text += String.Format("ReflectedType: {0}", hello.ReflectedType) + "\n";
}

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.