CodeBaseReferenceExpression 类

定义

表示对基类的引用。

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
继承
CodeBaseReferenceExpression
属性

示例

此示例演示如何使用引用 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 方法的重写将调用基。C# 中的 ToString()。

构造函数

名称 说明
CodeBaseReferenceExpression()

初始化 CodeBaseReferenceExpression 类的新实例。

属性

名称 说明
UserData

获取当前对象的用户可定义数据。

(继承自 CodeObject)

方法

名称 说明
Equals(Object)

确定指定的对象是否等于当前对象。

(继承自 Object)
GetHashCode()

用作默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
ToString()

返回一个表示当前对象的字符串。

(继承自 Object)

适用于