This documentation is archived and is not being maintained.

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 : CodeExpression

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.
CodeTypeDeclaration type1 = new CodeTypeDeclaration("Type1");

// Declares a constructor.
CodeConstructor constructor1 = new CodeConstructor();
constructor1.Attributes = MemberAttributes.Public;
type1.Members.Add( constructor1 );

// Declares an integer field.
CodeMemberField field1 = new CodeMemberField("System.Int32", "integerField");
type1.Members.Add( field1 );

// Declares a property.
CodeMemberProperty property1 = 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() ) );
type1.Members.Add( property1 );

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

//    public class Type1  
//    { 
// 
//        private int integerField; 
// 
//        public Type1()  
//        { 
//        } 
//                             
//        private int integerProperty  
//        { 
//            get  
//            { 
//                return this.integerField; 
//            } 
//            set  
//            { 
//                this.integerField = value; 
//            } 
//        } 
//    }

System.Object
  System.CodeDom.CodeObject
    System.CodeDom.CodeExpression
      System.CodeDom.CodePropertySetValueReferenceExpression

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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Show: