FieldDirection 列挙型

定義

パラメーターの方向および引数宣言を示すために使用する識別子を定義します。

public enum class FieldDirection
public enum FieldDirection
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum FieldDirection
type FieldDirection = 
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type FieldDirection = 
Public Enum FieldDirection
継承
FieldDirection
属性

フィールド

In 0

in フィールド。

Out 1

out フィールド。

Ref 2

参照渡しフィールド。

次の例では、メソッド宣言のメソッドの 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

注釈

FieldDirection では、参照による関数への引数の受け渡し、または受信パラメーターまたは送信パラメーターの使用が可能です。

適用対象

こちらもご覧ください