DeclaringType Property

DynamicMethod.DeclaringType Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets the type that declares the method, which is always Nothing for dynamic methods.

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

'Declaration
Public Overrides ReadOnly Property DeclaringType As Type

Property Value

Type: System.Type
Always Nothing.

This property always returns Nothing for dynamic methods. Even when a dynamic method is logically associated with a type, it is not declared by the type.

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


' Display the declaring type, which is always Nothing for dynamic
' methods.
If hello.DeclaringType Is Nothing Then
   outputBlock.Text &= "DeclaringType is always Nothing for dynamic methods." & vbLf
Else
   outputBlock.Text += String.Format("DeclaringType: {0}", hello.DeclaringType) & vbLf
End If


Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

Show:
© 2017 Microsoft