Export (0) Print
Expand All

CodePropertySetValueReferenceExpression Class

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

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

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

[SerializableAttribute]
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)]
public ref class CodePropertySetValueReferenceExpression : public CodeExpression

The CodePropertySetValueReferenceExpression type exposes the following members.

  NameDescription
Public methodCodePropertySetValueReferenceExpressionInitializes a new instance of the CodePropertySetValueReferenceExpression class.
Top

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

  NameDescription
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.)
Top

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 = gcnew CodeTypeDeclaration( "Type1" );

// Declares a constructor.
CodeConstructor^ constructor1 = gcnew CodeConstructor;
constructor1->Attributes = MemberAttributes::Public;
type1->Members->Add( constructor1 );

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

// Declares a property.
CodeMemberProperty^ property1 = gcnew CodeMemberProperty;

// Declares a property get statement to return the value of the integer field.
property1->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew 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( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"integerField" ),gcnew 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; 
//            } 
//        } 
//    }

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

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