CodeParameterDeclarationExpression クラス

定義

メソッド、プロパティ、またはコンストラクターのパラメーター宣言を表します。

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
継承
CodeParameterDeclarationExpression
属性

次の CodeParameterDeclarationExpression 例では、異なる FieldDirection フィールド参照型指定子を使用してメソッドのパラメーターを宣言する方法を示します。

// Declares a method.
CodeMemberMethod^ method1 = gcnew CodeMemberMethod;
method1->Name = "TestMethod";

// Declares a string parameter passed by reference.
CodeParameterDeclarationExpression^ param1 = gcnew CodeParameterDeclarationExpression( "System.String","stringParam" );
param1->Direction = FieldDirection::Ref;
method1->Parameters->Add( param1 );

// Declares a Int32 parameter passed by incoming field.
CodeParameterDeclarationExpression^ param2 = gcnew 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.
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

注釈

CodeParameterDeclarationExpression は、メソッド、プロパティ、またはコンストラクターのパラメーターを宣言するコードを表すために使用できます。

このプロパティは Name 、パラメーターの名前を指定します。 このプロパティは Type 、パラメーターのデータ型を指定します。 このプロパティは Direction 、パラメーターの方向修飾子を指定します。 このプロパティは CustomAttributes 、パラメーターに関連付けられている属性を指定します。

コンストラクター

CodeParameterDeclarationExpression()

CodeParameterDeclarationExpression クラスの新しいインスタンスを初期化します。

CodeParameterDeclarationExpression(CodeTypeReference, String)

パラメーター型とパラメーター名を指定して、CodeParameterDeclarationExpression クラスの新しいインスタンスを初期化します。

CodeParameterDeclarationExpression(String, String)

パラメーター型とパラメーター名を指定して、CodeParameterDeclarationExpression クラスの新しいインスタンスを初期化します。

CodeParameterDeclarationExpression(Type, String)

パラメーター型とパラメーター名を指定して、CodeParameterDeclarationExpression クラスの新しいインスタンスを初期化します。

プロパティ

CustomAttributes

パラメーター宣言のカスタム属性を取得または設定します。

Direction

フィールドの方向を取得または設定します。

Name

パラメーターの名前を取得または設定します。

Type

パラメーターの型を取得または設定します。

UserData

現在のオブジェクトのユーザー定義可能なデータを取得します。

(継承元 CodeObject)

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください