DynamicMethod.DeclaringType Tulajdonság
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Lekéri azt a típust, amely deklarálja a metódust, amely mindig null dinamikus metódusokhoz tartozik.
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
Tulajdonság értéke
Mindig null.
Példák
Az alábbi példakód egy dinamikus metódus deklarálási típusát jeleníti meg. Ez a példakód egy nagyobb, az DynamicMethod osztályhoz tartozó példa része.
// 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
Megjegyzések
Ez a tulajdonság mindig dinamikus metódusokhoz null ad vissza. Még akkor sem deklarálja a dinamikus metódust, ha logikailag egy típushoz van társítva.