CodePropertyReferenceExpression 類別

定義

表示屬性值的參考。

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

範例

下列範例程式代碼示範如何使用 CodePropertyReferenceExpression 來參考 屬性。

CodePropertyReferenceExpression^ propertyRef1 = gcnew CodePropertyReferenceExpression( gcnew CodeThisReferenceExpression,"TestProperty" );

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

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

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

'	Me.TestProperty

備註

CodePropertyReferenceExpression 可以用來表示屬性值的參考。

屬性 TargetObject 會指定要參考之屬性的物件。 屬性 PropertyName 會指定要參考的屬性名稱。

這個物件沒有 屬性,可指出參考是否用於 getset中。 如果屬性參考發生在指派語句的左邊,則為 set

建構函式

CodePropertyReferenceExpression()

初始化 CodePropertyReferenceExpression 類別的新執行個體。

CodePropertyReferenceExpression(CodeExpression, String)

使用指定的目標物件和屬性名稱來初始化 CodePropertyReferenceExpression 類別的新執行個體。

屬性

PropertyName

取得或設定要參考的屬性名稱。

TargetObject

取得或設定包含要參考屬性的物件。

UserData

取得目前物件的使用者可定義資料。

(繼承來源 CodeObject)

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於