CodeDirectionExpression Class
Represents an expression used as a method invoke parameter along with a reference direction indicator.
For a list of all members of this type, see CodeDirectionExpression Members.
System.Object
System.CodeDom.CodeObject
System.CodeDom.CodeExpression
System.CodeDom.CodeDirectionExpression
[Visual Basic] <Serializable> <ClassInterface(ClassInterfaceType.AutoDispatch)> <ComVisible(True)> Public Class CodeDirectionExpression Inherits CodeExpression [C#] [Serializable] [ClassInterface(ClassInterfaceType.AutoDispatch)] [ComVisible(true)] public class CodeDirectionExpression : CodeExpression [C++] [Serializable] [ClassInterface(ClassInterfaceType::AutoDispatch)] [ComVisible(true)] public __gc class CodeDirectionExpression : public CodeExpression [JScript] public Serializable ClassInterface(ClassInterfaceType.AutoDispatch) ComVisible(true) class CodeDirectionExpression extends CodeExpression
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
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.
Example
[Visual Basic, C#, C++] The following example demonstrates use of a CodeDirectionExpression to specify a field direction modifier for an expression to pass as a method parameter.
[Visual Basic] ' 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") [C#] // 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); [C++] // Declares a parameter passed by reference using a CodeDirectionExpression. CodeDirectionExpression* param1[] = {new CodeDirectionExpression(FieldDirection::Ref, new CodeFieldReferenceExpression( new CodeThisReferenceExpression(), S"TestParameter" ))}; // Invokes a method on this named TestMethod using the direction expression as a parameter. CodeMethodInvokeExpression* methodInvoke1 = new CodeMethodInvokeExpression(new CodeThisReferenceExpression(), S"TestMethod", param1 ); // A C# code generator produces the following source code for the preceeding example code: // this.TestMethod(ref TestParameter);
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.CodeDom
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System (in System.dll)