Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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
/** @attribute SerializableAttribute() */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class CodePropertySetValueReferenceExpression extends CodeExpression
SerializableAttribute 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class CodePropertySetValueReferenceExpression extends CodeExpression
Not applicable.

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;
//            }
//        }
//    }

// Declares a type.
CodeTypeDeclaration type1 = new CodeTypeDeclaration("Type1");
// Declares a constructor.
CodeConstructor constructor1 = new CodeConstructor();
constructor1.set_Attributes(MemberAttributes.Public);
type1.get_Members().Add(constructor1);
// Declares an integer field.
CodeMemberField field1 = new CodeMemberField("System.Int32",
    "integerField");
type1.get_Members().Add(field1);
// Declares a property.
CodeMemberProperty property1 = new CodeMemberProperty();
// Declares a property get statement to return the value
// of the integer field.
property1.get_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.get_SetStatements().Add(new CodeAssignStatement(new 
    CodeFieldReferenceExpression(new CodeThisReferenceExpression(), 
    "integerField"), new CodePropertySetValueReferenceExpression()));
type1.get_Members().Add(property1);
// A VJ# code generator produces the following source code for the 
// preceeding example code:
// public class Type1
// {
//     private int integerField;
//
//     public Type1()
//     {
//     } //Type1
//
//     /** @property 
//      */
//     private int get_integerProperty()
//     {
//         return this.integerField;
//     } //get_integerProperty
//
//     /** @property 
//      */
//     private void set_integerProperty(int value)
//     {
//         this.integerField = value;
//     } //set_integerProperty
// } //Type1

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 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.