CodePropertySetValueReferenceExpression Osztály
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Egy tulajdonsághalmaz metódushívásának értékargumentumát jelöli egy tulajdonságkészlet-metóduson belül.
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
- Öröklődés
- Attribútumok
Példák
Ez a példa azt mutatja be, hogy a CodePropertySetValueReferenceExpression tulajdonsághalmaz értékkimutatási blokkjának átadott értékargumentumot egy adott értékargumentum ábrázolja.
// 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
Megjegyzések
CodePropertySetValueReferenceExpression egy tulajdonságkészlet-metódushívás értékargumentumát jelöli egy tulajdonságkészlet-metódus deklarációja során.
A tulajdonságkészlet-metódus általában a tulajdonsághoz rendelt értéket rendeli hozzá vagy használja. A tulajdonsághalmaz metódusán belül ezt az értéket egy implicit változó képviseli a CodeDOM-ban egy CodePropertySetValueReferenceExpression.
Konstruktorok
| Name | Description |
|---|---|
| CodePropertySetValueReferenceExpression() |
Inicializálja a CodePropertySetValueReferenceExpression osztály új példányát. |
Tulajdonságok
| Name | Description |
|---|---|
| UserData |
Lekéri az aktuális objektum felhasználó által definiálható adatait. (Öröklődés forrása CodeObject) |
Metódusok
| Name | Description |
|---|---|
| Equals(Object) |
Meghatározza, hogy a megadott objektum egyenlő-e az aktuális objektummal. (Öröklődés forrása Object) |
| GetHashCode() |
Ez az alapértelmezett kivonatoló függvény. (Öröklődés forrása Object) |
| GetType() |
Lekéri az Type aktuális példányt. (Öröklődés forrása Object) |
| MemberwiseClone() |
Az aktuális Objectpéldány sekély másolatát hozza létre. (Öröklődés forrása Object) |
| ToString() |
Az aktuális objektumot jelképező sztringet ad vissza. (Öröklődés forrása Object) |