Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

CodeDirectionExpression Class

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

Namespace: System.CodeDom
Assembly: System (in system.dll)

[SerializableAttribute] 
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] 
[ComVisibleAttribute(true)] 
public class CodeDirectionExpression : CodeExpression
/** @attribute SerializableAttribute() */ 
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class CodeDirectionExpression extends CodeExpression
SerializableAttribute 
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) 
ComVisibleAttribute(true) 
public class CodeDirectionExpression extends CodeExpression
Not applicable.

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.

NoteNote:

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

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.
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.
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", new CodeExpression[] { (CodeExpression)param1 });
// A VJ# code generator produces the following source code for the 
// preceeding example code:    
// this.TestMethod(ref TestParameter);

System.Object
   System.CodeDom.CodeObject
     System.CodeDom.CodeExpression
      System.CodeDom.CodeDirectionExpression
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.