FieldDirection 列挙体
アセンブリ: System (system.dll 内)

<SerializableAttribute> _ <ComVisibleAttribute(True)> _ Public Enumeration FieldDirection



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

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- FieldDirection 列挙体のページへのリンク