CodePropertyReferenceExpression CodePropertyReferenceExpression CodePropertyReferenceExpression CodePropertyReferenceExpression Class

定義

表示屬性值的參考。Represents a reference to the value of a property.

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

範例

下列範例程式碼示範CodePropertyReferenceExpression如何使用來參考屬性。The following example code demonstrates use of a CodePropertyReferenceExpression to refer to a property.

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可以用來表示屬性值的參考。CodePropertyReferenceExpression can be used to represent a reference to the value of a property.

TargetObject屬性會指定包含要參考之屬性的物件。The TargetObject property specifies the object that contains the property to reference. PropertyName屬性會指定要參考之屬性的名稱。The PropertyName property specifies the name of the property to reference.

這個物件沒有屬性可指出參考是否在getset中使用。This object does not have a property to indicate whether the reference is used in a get or set. 如果屬性參考出現在左側, 指派給指派語句的端, 則它是setIf the property reference occurs on the left, assigned to, side of an assignment statement, then it is a set.

建構函式

CodePropertyReferenceExpression() CodePropertyReferenceExpression() CodePropertyReferenceExpression() CodePropertyReferenceExpression()

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

CodePropertyReferenceExpression(CodeExpression, String) CodePropertyReferenceExpression(CodeExpression, String) CodePropertyReferenceExpression(CodeExpression, String) CodePropertyReferenceExpression(CodeExpression, String)

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

屬性

PropertyName PropertyName PropertyName PropertyName

取得或設定要參考的屬性名稱。Gets or sets the name of the property to reference.

TargetObject TargetObject TargetObject TargetObject

取得或設定包含要參考屬性的物件。Gets or sets the object that contains the property 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)

適用於