CodeDirectionExpression CodeDirectionExpression CodeDirectionExpression CodeDirectionExpression Class

Definition

Represents an expression used as a method invoke parameter along with a reference direction indicator.

public ref class CodeDirectionExpression : System::CodeDom::CodeExpression
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Serializable]
public class CodeDirectionExpression : System.CodeDom.CodeExpression
type CodeDirectionExpression = class
    inherit CodeExpression
Public Class CodeDirectionExpression
Inherits CodeExpression
Inheritance
CodeDirectionExpressionCodeDirectionExpressionCodeDirectionExpressionCodeDirectionExpression
Attributes

Examples

The following example demonstrates use of a CodeDirectionExpression to specify a field direction modifier for an expression to pass as a method parameter.

// Declares a parameter passed by reference using a CodeDirectionExpression.
array<CodeDirectionExpression^>^param1 = {gcnew CodeDirectionExpression( FieldDirection::Ref,gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"TestParameter" ) )};

// Invokes a method on this named TestMethod using the direction expression as a parameter.
CodeMethodInvokeExpression^ methodInvoke1 = gcnew CodeMethodInvokeExpression( gcnew CodeThisReferenceExpression,"TestMethod",param1 );

// A C# code generator produces the following source code for the preceeding example code:
//        this.TestMethod(ref TestParameter);
// Declares a parameter passed by reference using a CodeDirectionExpression.
CodeDirectionExpression param1 = new CodeDirectionExpression(FieldDirection.Ref, new CodeFieldReferenceExpression( new CodeThisReferenceExpression(), "TestParameter" ));
// Invokes a method on this named TestMethod using the direction expression as a parameter.
CodeMethodInvokeExpression methodInvoke1 = new CodeMethodInvokeExpression(new CodeThisReferenceExpression(), "TestMethod", param1 );

// A C# code generator produces the following source code for the preceeding example code:    

//        this.TestMethod(ref TestParameter);
' Declares a parameter passed by reference using a CodeDirectionExpression.
Dim param1 As New CodeDirectionExpression(FieldDirection.Ref, New CodeFieldReferenceExpression(New CodeThisReferenceExpression(), "TestParameter"))
' Invokes a method on this named TestMethod using the direction expression as a parameter.
Dim methodInvoke1 As New CodeMethodInvokeExpression(New CodeThisReferenceExpression(), "TestMethod", param1)

' A Visual Basic code generator produces the following source code for the preceeding example code:	

'      Me.TestMethod("TestParameter")

Remarks

CodeDirectionExpression can represent a parameter passed to a method and the reference direction of the parameter.

The Expression property indicates the expression to qualify with a direction. The Direction property indicates the direction of the parameter using one of the FieldDirection enumeration values.

Note

CodeDirectionExpression is intended to be used as a method invoke parameter, and should not be used when declaring methods.

Constructors

CodeDirectionExpression() CodeDirectionExpression() CodeDirectionExpression() CodeDirectionExpression()

Initializes a new instance of the CodeDirectionExpression class.

CodeDirectionExpression(FieldDirection, CodeExpression) CodeDirectionExpression(FieldDirection, CodeExpression) CodeDirectionExpression(FieldDirection, CodeExpression) CodeDirectionExpression(FieldDirection, CodeExpression)

Initializes a new instance of the CodeDirectionExpression class using the specified field direction and expression.

Properties

Direction Direction Direction Direction

Gets or sets the field direction for this direction expression.

Expression Expression Expression Expression

Gets or sets the code expression to represent.

UserData UserData UserData UserData

Gets the user-definable data for the current object.

(Inherited from CodeObject)

Methods

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to