CodeBaseReferenceExpression-Klasse
Stellt einen Verweis auf die Basisklasse dar.
Namespace: System.CodeDom
Assembly: System (in system.dll)
Syntax
'Declaration
<SerializableAttribute> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class CodeBaseReferenceExpression
Inherits CodeExpression
'Usage
Dim instance As CodeBaseReferenceExpression
[SerializableAttribute]
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
[ComVisibleAttribute(true)]
public class CodeBaseReferenceExpression : CodeExpression
[SerializableAttribute]
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)]
[ComVisibleAttribute(true)]
public ref class CodeBaseReferenceExpression : public CodeExpression
/** @attribute SerializableAttribute() */
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */
/** @attribute ComVisibleAttribute(true) */
public class CodeBaseReferenceExpression extends CodeExpression
SerializableAttribute
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)
ComVisibleAttribute(true)
public class CodeBaseReferenceExpression extends CodeExpression
Hinweise
CodeBaseReferenceExpression stellt einen Verweis auf die Basisklasse der aktuellen Klasse dar. Die Basisklasse wird gelegentlich auch als übergeordnete Klasse bezeichnet. Verweise auf die Basisklasse werden i. d. R. beim Überschreiben einer Methode oder Eigenschaft verwendet, um die Implementierung der Basisklasse für die betreffende Methode bzw. Eigenschaft aufzurufen. Durch eine Überschreibung einer ToString-Methode, die eine Zeichenfolge an das Ende der ToString-Methode der Basisklasse anfügt, wird z. B. base.ToString() in C# aufgerufen.
Beispiel
In diesem Beispiel wird veranschaulicht, wie mit einer CodeBaseReferenceExpression auf eine Basisklassenmethode verwiesen wird.
' Example method invoke expression uses CodeBaseReferenceExpression to produce
' a base.Dispose method call
Dim methodInvokeExpression As New CodeMethodInvokeExpression( New CodeBaseReferenceExpression(), "Dispose", New CodeExpression() {})
' A Visual Basic code generator produces the following source code for the preceeding example code:
' MyBase.Dispose
// Example method invoke expression uses CodeBaseReferenceExpression to produce
// a base.Dispose method call
CodeMethodInvokeExpression methodInvokeExpression =
// Creates a method invoke expression
new CodeMethodInvokeExpression(
// targetObject parameter can be a
// base class reference
new CodeBaseReferenceExpression(),
// Method name and method parameter arguments
"Dispose", new CodeExpression[] {});
// A C# code generator produces the following source code for the preceeding example code:
// base.Dispose();
// Example method invoke expression uses CodeBaseReferenceExpression to produce
// a base.Dispose method call
CodeMethodInvokeExpression^ methodInvokeExpression =
gcnew CodeMethodInvokeExpression( // Creates a method invoke expression
gcnew CodeBaseReferenceExpression, // targetObjectparameter can be a base class reference
"Dispose",gcnew array<CodeExpression^>{} ); // Method name and method parameter arguments
// A C# code generator produces the following source code for the preceeding example code:
// base.Dispose();
// Example method invoke expression uses CodeBaseReferenceExpression
// to produce
// a base.Dispose method call
CodeMethodInvokeExpression methodInvokeExpression =
// Creates a method invoke expression
new CodeMethodInvokeExpression(
// targetObject parameter can be a
// base class reference
new CodeBaseReferenceExpression(),
// Method name and method parameter arguments
"Dispose", new CodeExpression[]{});
// A VJ# code generator produces the following source code for the
// preceeding example code:
// super.Dispose();
Vererbungshierarchie
System.Object
System.CodeDom.CodeObject
System.CodeDom.CodeExpression
System.CodeDom.CodeBaseReferenceExpression
Threadsicherheit
Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.
Plattformen
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0