CodeDirectionExpression Class
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.
Note: |
|---|
| 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.CodeDom.CodeObject
System.CodeDom.CodeExpression
System.CodeDom.CodeDirectionExpression
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.
Note: