FieldDirection Enum

Definitie

Definieert id's die worden gebruikt om de richting van parameter- en argumentdeclaraties aan te geven.

public enum class FieldDirection
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public enum FieldDirection
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type FieldDirection = 
Public Enum FieldDirection
Overname
FieldDirection
Kenmerken

Velden

Name Waarde Description
In 0

Een binnenkomend veld.

Out 1

Een uitgaand veld.

Ref 2

Een veld per verwijzing.

Voorbeelden

In het volgende voorbeeld ziet u FieldDirection hoe u de veldrichtingstypen van de parameters van een methode in een methodedeclaratie aangeeft.

// 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

Opmerkingen

FieldDirection maakt het mogelijk om argumenten door te geven aan functies op basis van referentie of met behulp van binnenkomende of uitgaande parameters.

Van toepassing op

Zie ook