DynamicMethod.DeclaringType Vlastnost

Definice

Získá typ, který deklaruje metodu , která je vždy null pro dynamické metody.

public:
 virtual property Type ^ DeclaringType { Type ^ get(); };
public override Type? DeclaringType { get; }
public override Type DeclaringType { get; }
member this.DeclaringType : Type
Public Overrides ReadOnly Property DeclaringType As Type

Hodnota vlastnosti

Vždy hodnota null.

Příklady

Následující příklad kódu zobrazí deklarující typ dynamické metody. Tento příklad kódu je součástí většího příkladu DynamicMethod pro třídu .

// Display the declaring type, which is always null for dynamic
// methods.
if (hello->DeclaringType == nullptr)
{
    Console::WriteLine("\r\nDeclaringType is always null for dynamic methods.");
}
else
{
    Console::WriteLine("DeclaringType: {0}", hello->DeclaringType);
}
// Display the declaring type, which is always null for dynamic
// methods.
if (hello.DeclaringType == null)
{
    Console.WriteLine("\r\nDeclaringType is always null for dynamic methods.");
}
else
{
    Console.WriteLine("DeclaringType: {0}", hello.DeclaringType);
}
' Display the declaring type, which is always Nothing for dynamic
' methods.
If hello.DeclaringType Is Nothing Then
    Console.WriteLine(vbCrLf & "DeclaringType is always Nothing for dynamic methods.")
Else
    Console.WriteLine("DeclaringType: {0}", hello.DeclaringType)
End If

Poznámky

Tato vlastnost se vždy vrátí null pro dynamické metody. I když je dynamická metoda logicky přidružena k typu, není typem deklarována.

Platí pro