CodeBaseReferenceExpression 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
代表對基底類別的參考。
public ref class CodeBaseReferenceExpression : System::CodeDom::CodeExpression
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeBaseReferenceExpression : System.CodeDom.CodeExpression
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeBaseReferenceExpression = class
inherit CodeExpression
Public Class CodeBaseReferenceExpression
Inherits CodeExpression
- 繼承
- 屬性
範例
此範例示範使用 a CodeBaseReferenceExpression 來參考基底類別方法。
// 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 代表對當前類別基底類別的參考。 基底類別有時也被稱為父類別或超類別。 當覆寫某個方法或屬性,以呼叫該基底類別對該方法或屬性的實作時,通常會使用對基底類別的引用。 例如,若將 ToString 方法的覆寫附加字串到基類 ToString 方法的末尾,則會呼叫 base。在 C# 中。
建構函式
| 名稱 | Description |
|---|---|
| CodeBaseReferenceExpression() |
初始化 CodeBaseReferenceExpression 類別的新執行個體。 |
屬性
| 名稱 | Description |
|---|---|
| UserData |
取得目前物件的使用者可定義資料。 (繼承來源 CodeObject) |
方法
| 名稱 | Description |
|---|---|
| Equals(Object) |
判斷指定的 物件是否等於目前的物件。 (繼承來源 Object) |
| GetHashCode() |
做為預設雜湊函式。 (繼承來源 Object) |
| GetType() |
取得目前實例的 Type。 (繼承來源 Object) |
| MemberwiseClone() |
建立目前 Object的淺層複本。 (繼承來源 Object) |
| ToString() |
傳回表示目前 物件的字串。 (繼承來源 Object) |