Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

CodePropertySetValueReferenceExpression Class

Represents the value argument of a property set method call within a property set method.


Namespace:  System.CodeDom
Assembly:  System (in System.dll)

<SerializableAttribute> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
<ComVisibleAttribute(True)> _
Public Class CodePropertySetValueReferenceExpression _
	Inherits CodeExpression

The CodePropertySetValueReferenceExpression type exposes the following members.

Public methodCodePropertySetValueReferenceExpressionInitializes a new instance of the CodePropertySetValueReferenceExpression class.

Public propertyUserDataGets the user-definable data for the current object. (Inherited from CodeObject.)

Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

CodePropertySetValueReferenceExpression represents the value argument of a property set method call within a property set method declaration.

A property set method typically assigns or uses the value assigned to the property. Within the property set method, this value is represented by an implicit variable represented in CodeDOM by a CodePropertySetValueReferenceExpression.

This example demonstrates use of a CodePropertySetValueReferenceExpression to represent the value argument passed to a property set value statement block.

' Declares a type. 
Dim type1 As New CodeTypeDeclaration("Type1")

' Declares a constructor. 
Dim constructor1 As New CodeConstructor()
constructor1.Attributes = MemberAttributes.Public

' Declares an integer field. 
Dim field1 As New CodeMemberField("System.Int32", "integerField")

' Declares a property. 
Dim property1 As New CodeMemberProperty()
' Declares a property get statement to return the value of the integer field.
property1.GetStatements.Add(New CodeMethodReturnStatement(New CodeFieldReferenceExpression(New CodeThisReferenceExpression(), "integerField")))
' Declares a property set statement to set the value to the integer field. 
' The CodePropertySetValueReferenceExpression represents the value argument passed to the property set statement.
property1.SetStatements.Add(New CodeAssignStatement(New CodeFieldReferenceExpression(New CodeThisReferenceExpression(), "integerField"), New CodePropertySetValueReferenceExpression()))

' A Visual Basic code generator produces the following source code for the preceeding example code: 

'   Public Class Type1 

'       Private integerField As Integer 

'       Public Sub New() 
'           MyBase.New() 
'       End Sub 

'       Private Property integerProperty() As Integer 
'           Get 
'               Return Me.integerField 
'           End Get 
'           Set(ByVal Value As Integer) 
'               Me.integerField = value 
'           End Set 
'       End Property 
'   End Class

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2015 Microsoft