CodeParameterDeclarationExpression 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 metódus, tulajdonság vagy konstruktor paraméterdeklarációja.
public ref class CodeParameterDeclarationExpression : System::CodeDom::CodeExpression
public class CodeParameterDeclarationExpression : System.CodeDom.CodeExpression
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeParameterDeclarationExpression : System.CodeDom.CodeExpression
type CodeParameterDeclarationExpression = class
inherit CodeExpression
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeParameterDeclarationExpression = class
inherit CodeExpression
Public Class CodeParameterDeclarationExpression
Inherits CodeExpression
- Öröklődés
- Attribútumok
Példák
Az alábbi példa egy metódus paramétereinek deklarálását mutatja CodeParameterDeclarationExpression be különböző FieldDirection mezőhivatkozás-típusjelölők használatával.
// Declares a method.
CodeMemberMethod method1 = new CodeMemberMethod();
method1.Name = "TestMethod";
// Declares a string parameter passed by reference.
CodeParameterDeclarationExpression param1 = new CodeParameterDeclarationExpression("System.String", "stringParam");
param1.Direction = FieldDirection.Ref;
method1.Parameters.Add(param1);
// Declares a Int32 parameter passed by incoming field.
CodeParameterDeclarationExpression param2 = new CodeParameterDeclarationExpression("System.Int32", "intParam");
param2.Direction = FieldDirection.Out;
method1.Parameters.Add(param2);
// A C# code generator produces the following source code for the preceeding example code:
// private void TestMethod(ref string stringParam, out int intParam) {
// }
' Declares a method.
Dim method1 As New CodeMemberMethod()
method1.Name = "TestMethod"
' Declares a string parameter passed by reference.
Dim param1 As New CodeParameterDeclarationExpression("System.String", "stringParam")
param1.Direction = FieldDirection.Ref
method1.Parameters.Add(param1)
' Declares a Int32 parameter passed by incoming field.
Dim param2 As New CodeParameterDeclarationExpression("System.Int32", "intParam")
param2.Direction = FieldDirection.Out
method1.Parameters.Add(param2)
' A Visual Basic code generator produces the following source code for the preceeding example code:
' Private Sub TestMethod(ByRef stringParam As String, ByRef intParam As Integer)
' End Sub
Megjegyzések
CodeParameterDeclarationExpression Olyan kód ábrázolására használható, amely egy metódus, tulajdonság vagy konstruktor paraméterét deklarálja.
A Name tulajdonság a paraméter nevét adja meg. A Type tulajdonság a paraméter adattípusát adja meg. A Direction tulajdonság a paraméter iránymódosítóját adja meg. A CustomAttributes tulajdonság a paraméterhez társított attribútumokat adja meg.
Konstruktorok
| Name | Description |
|---|---|
| CodeParameterDeclarationExpression() |
Inicializálja a CodeParameterDeclarationExpression osztály új példányát. |
| CodeParameterDeclarationExpression(CodeTypeReference, String) |
Inicializálja az osztály új példányát a CodeParameterDeclarationExpression megadott paramétertípus és -név használatával. |
| CodeParameterDeclarationExpression(String, String) |
Inicializálja az osztály új példányát a CodeParameterDeclarationExpression megadott paramétertípus és -név használatával. |
| CodeParameterDeclarationExpression(Type, String) |
Inicializálja az osztály új példányát a CodeParameterDeclarationExpression megadott paramétertípus és -név használatával. |
Tulajdonságok
| Name | Description |
|---|---|
| CustomAttributes |
Lekéri vagy beállítja a paraméterdeklaráció egyéni attribútumait. |
| Direction |
Lekéri vagy beállítja a mező irányát. |
| Name |
Lekéri vagy beállítja a paraméter nevét. |
| Type |
Lekéri vagy beállítja a paraméter típusát. |
| 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) |