CodeFieldReferenceExpression CodeFieldReferenceExpression CodeFieldReferenceExpression CodeFieldReferenceExpression Class

定義

表示欄位的參考。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
繼承
CodeFieldReferenceExpressionCodeFieldReferenceExpressionCodeFieldReferenceExpressionCodeFieldReferenceExpression
屬性

範例

下列範例示範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() CodeFieldReferenceExpression() CodeFieldReferenceExpression()

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

CodeFieldReferenceExpression(CodeExpression, String) CodeFieldReferenceExpression(CodeExpression, String) CodeFieldReferenceExpression(CodeExpression, String) CodeFieldReferenceExpression(CodeExpression, String)

使用指定的目標物件和欄位名稱來初始化 CodeFieldReferenceExpression 類別的新執行個體。Initializes a new instance of the CodeFieldReferenceExpression class using the specified target object and field name.

屬性

FieldName FieldName FieldName FieldName

取得或設定要參考的欄位名稱。Gets or sets the name of the field to reference.

TargetObject TargetObject TargetObject TargetObject

取得或設定包含要參考欄位的物件。Gets or sets the object that contains the field to reference.

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)

適用於