Export (0) Print
Expand All

CodeBaseReferenceExpression Class

Represents a reference to the base class.

For a list of all members of this type, see CodeBaseReferenceExpression Members.

System.Object
   System.CodeDom.CodeObject
      System.CodeDom.CodeExpression
         System.CodeDom.CodeBaseReferenceExpression

[Visual Basic]
<Serializable>
<ClassInterface(ClassInterfaceType.AutoDispatch)>
<ComVisible(True)>
Public Class CodeBaseReferenceExpression
   Inherits CodeExpression
[C#]
[Serializable]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ComVisible(true)]
public class CodeBaseReferenceExpression : CodeExpression
[C++]
[Serializable]
[ClassInterface(ClassInterfaceType::AutoDispatch)]
[ComVisible(true)]
public __gc class CodeBaseReferenceExpression : public
   CodeExpression
[JScript]
public
   Serializable
 ClassInterface(ClassInterfaceType.AutoDispatch)
 ComVisible(true)
class CodeBaseReferenceExpression extends CodeExpression

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

CodeBaseReferenceExpression represents a reference to the base class of the current class. The base class is sometimes also known as the parent class or super class. References to the base class are commonly used when overriding a method or property in order to call the base class's implementation of that method or property. For example, an override of a ToString method that appends a string to the end of the base class's ToString method would call base.ToString() in C#.

Example

[Visual Basic, C#, C++] This example demonstrates using a CodeBaseReferenceExpression to reference a base class method.

[Visual Basic] 
' 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

[C#] 
// 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();


[C++] 
// 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
    S"Dispose", new CodeExpression*[]);

// A C# code generator produces the following source code for the preceeding example code:

// base.Dispose();

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.CodeDom

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System (in System.dll)

See Also

CodeBaseReferenceExpression Members | System.CodeDom Namespace

Show:
© 2015 Microsoft