CodeParameterDeclarationExpression クラス
アセンブリ: System (system.dll 内)

<SerializableAttribute> _ <ComVisibleAttribute(True)> _ <ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _ Public Class CodeParameterDeclarationExpression Inherits CodeExpression
[SerializableAttribute] [ComVisibleAttribute(true)] [ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] public class CodeParameterDeclarationExpression : CodeExpression
[SerializableAttribute] [ComVisibleAttribute(true)] [ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] public ref class CodeParameterDeclarationExpression : public CodeExpression

CodeParameterDeclarationExpression を使用して、メソッド、プロパティ、またはコンストラクタのパラメータを宣言するコードを表すことができます。
Name プロパティは、パラメータの名前を指定します。Type プロパティは、パラメータのデータ型を指定します。Direction プロパティは、パラメータの方向修飾子を指定します。CustomAttributes プロパティは、パラメータに関連付けられる属性を指定します。

CodeParameterDeclarationExpression を使用して、異なる FieldDirection フィールド参照型指定子を使用したメソッドのパラメータを宣言する例を次に示します。
' 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
// 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. 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.set_Name("TestMethod"); // Declares a string parameter passed by reference. CodeParameterDeclarationExpression param1 = new CodeParameterDeclarationExpression("System.String", "stringParam"); param1.set_Direction(FieldDirection.Ref); method1.get_Parameters().Add(param1); // Declares a Int32 parameter passed by incoming field. CodeParameterDeclarationExpression param2 = new CodeParameterDeclarationExpression("System.Int32", "intParam"); param2.set_Direction(FieldDirection.Out); method1.get_Parameters().Add(param2); // A VJ# code generator produces the following source code for // the preceeding example code: // private void TestMethod(/** @ref */ String stringParam, // /** @ref */ int intParam) // { // } //TestMethod

System.CodeDom.CodeObject
System.CodeDom.CodeExpression
System.CodeDom.CodeParameterDeclarationExpression


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


CodeParameterDeclarationExpression メンバ
System.CodeDom 名前空間
CodeParameterDeclarationExpressionCollection
- CodeParameterDeclarationExpression クラスのページへのリンク