CodePropertyReferenceExpression Class
Represents a reference to the value of a property.
For a list of all members of this type, see CodePropertyReferenceExpression Members.
System.Object
System.CodeDom.CodeObject
System.CodeDom.CodeExpression
System.CodeDom.CodePropertyReferenceExpression
[Visual Basic] <Serializable> <ClassInterface(ClassInterfaceType.AutoDispatch)> <ComVisible(True)> Public Class CodePropertyReferenceExpression Inherits CodeExpression [C#] [Serializable] [ClassInterface(ClassInterfaceType.AutoDispatch)] [ComVisible(true)] public class CodePropertyReferenceExpression : CodeExpression [C++] [Serializable] [ClassInterface(ClassInterfaceType::AutoDispatch)] [ComVisible(true)] public __gc class CodePropertyReferenceExpression : public CodeExpression [JScript] public Serializable ClassInterface(ClassInterfaceType.AutoDispatch) ComVisible(true) class CodePropertyReferenceExpression extends CodeExpression
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
CodePropertyReferenceExpression can be used to represent a reference to the value of a property.
The TargetObject property specifies the object that contains the property to reference. The PropertyName property specifies the name of the property to reference.
This object does not have a property to indicate whether the reference is used in a get or set. If the property reference occurs on the left, assigned to, side of an assignment statement, then it is a set.
Example
[Visual Basic, C#, C++] The following example code demonstrates use of a CodePropertyReferenceExpression to refer to a property.
[Visual Basic] 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 [C#] CodePropertyReferenceExpression propertyRef1 = new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), "TestProperty"); // A C# code generator produces the following source code for the preceeding example code: // this.TestProperty [C++] CodePropertyReferenceExpression* propertyRef1 = new CodePropertyReferenceExpression(new CodeThisReferenceExpression(), S"TestProperty"); // A C# code generator produces the following source code for the preceeding example code: // this.TestProperty
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.CodeDom
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System (in System.dll)
See Also
CodePropertyReferenceExpression Members | System.CodeDom Namespace