CodeBaseReferenceExpression CodeBaseReferenceExpression CodeBaseReferenceExpression CodeBaseReferenceExpression Class

定義

表示基底類別的參考。Represents a reference to the base class.

public ref class CodeBaseReferenceExpression : System::CodeDom::CodeExpression
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Serializable]
public class CodeBaseReferenceExpression : System.CodeDom.CodeExpression
type CodeBaseReferenceExpression = class
    inherit CodeExpression
Public Class CodeBaseReferenceExpression
Inherits CodeExpression
繼承
CodeBaseReferenceExpressionCodeBaseReferenceExpressionCodeBaseReferenceExpressionCodeBaseReferenceExpression
屬性

範例

這個範例示範如何使用CodeBaseReferenceExpression來參考基類方法。This example demonstrates using a CodeBaseReferenceExpression to reference a base class method.

// 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 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
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

備註

CodeBaseReferenceExpression表示目前類別之基類的參考。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. 例如, 將字串附加至基類的ToString方法結尾之 ToString 方法的覆寫會呼叫 base。中的C#ToString ()。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#.

建構函式

CodeBaseReferenceExpression() CodeBaseReferenceExpression() CodeBaseReferenceExpression() CodeBaseReferenceExpression()

初始化 CodeBaseReferenceExpression 類別的新執行個體。Initializes a new instance of the CodeBaseReferenceExpression class.

屬性

UserData UserData UserData UserData

取得目前物件的使用者可定義資料。Gets the user-definable data for the current object.

(Inherited from CodeObject)

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於