CodeFieldReferenceExpression 类

定义

表示对某字段的引用。Represents a reference to a field.

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

示例

下面的示例演示CodeFieldReferenceExpression如何使用引用字段。The following example demonstrates use of a CodeFieldReferenceExpression to reference a field.

CodeFieldReferenceExpression^ fieldRef1 = gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"TestField" );

// A C# code generator produces the following source code for the preceeding example code:
//    this.TestField
CodeFieldReferenceExpression fieldRef1 = 
    new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), "TestField");

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

//    this.TestField
Dim fieldRef1 As New CodeFieldReferenceExpression(New CodeThisReferenceExpression(), "TestField")
' A Visual Basic code generator produces the following source code for the preceeding example code:

'	Me.TestField

注解

CodeFieldReferenceExpression可用于表示对字段的引用。CodeFieldReferenceExpression can be used to represent a reference to a field.

TargetObject属性指定包含字段的对象。The TargetObject property specifies the object that contains the field. FieldName属性指定要引用的字段的名称。The FieldName property specifies the name of the field to reference.

构造函数

CodeFieldReferenceExpression()

初始化 CodeFieldReferenceExpression 类的新实例。Initializes a new instance of the CodeFieldReferenceExpression class.

CodeFieldReferenceExpression(CodeExpression, String)

使用指定的目标对象和字段名称初始化 CodeFieldReferenceExpression 类的新实例。Initializes a new instance of the CodeFieldReferenceExpression class using the specified target object and field name.

属性

FieldName

获取或设置要引用的字段的名称。Gets or sets the name of the field to reference.

TargetObject

获取或设置包含要引用字段的对象。Gets or sets the object that contains the field to reference.

UserData

获取当前对象的用户可定义数据。Gets the user-definable data for the current object.

(继承自 CodeObject)

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于