CodePropertySetValueReferenceExpression 클래스

정의

property set 메서드에서 property set 메서드 호출의 값 인수를 나타냅니다.

public ref class CodePropertySetValueReferenceExpression : System::CodeDom::CodeExpression
public class CodePropertySetValueReferenceExpression : System.CodeDom.CodeExpression
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodePropertySetValueReferenceExpression : System.CodeDom.CodeExpression
type CodePropertySetValueReferenceExpression = class
    inherit CodeExpression
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodePropertySetValueReferenceExpression = class
    inherit CodeExpression
Public Class CodePropertySetValueReferenceExpression
Inherits CodeExpression
상속
CodePropertySetValueReferenceExpression
특성

예제

이 예제에서는 사용 CodePropertySetValueReferenceExpression 하는 속성 집합 값 문 블록에 전달 되는 값 인수를 나타내는 합니다.

// 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;
//            }
//        }
//    }
// 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.
Dim type1 As New CodeTypeDeclaration("Type1")

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

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

' 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()))
type1.Members.Add(property1)

' 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

설명

CodePropertySetValueReferenceExpression 는 속성 집합 메서드 선언 내에서 속성 집합 메서드 호출의 값 인수를 나타냅니다.

속성 집합 메서드는 일반적으로 속성에 할당된 값을 할당하거나 사용합니다. 속성 집합 메서드 내에서 이 값은 CodeDOM에서 로 표현되는 암시적 변수로 CodePropertySetValueReferenceExpression표시됩니다.

생성자

CodePropertySetValueReferenceExpression()

CodePropertySetValueReferenceExpression 클래스의 새 인스턴스를 초기화합니다.

속성

UserData

현재 개체에 대해 사용자 정의 가능한 데이터를 가져옵니다.

(다음에서 상속됨 CodeObject)

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상