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)

System.Object
  System.CodeDom.CodeObject
    System.CodeDom.CodeExpression
      System.CodeDom.CodeDirectionExpression

[SerializableAttribute]
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
[ComVisibleAttribute(true)]
public class CodeDirectionExpression : CodeExpression

NameDescription
System_CAPS_pubmethodCodeDirectionExpression()

Initializes a new instance of the CodeDirectionExpression class.

System_CAPS_pubmethodCodeDirectionExpression(FieldDirection, CodeExpression)

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

NameDescription
System_CAPS_pubpropertyDirection

Gets or sets the field direction for this direction expression.

System_CAPS_pubpropertyExpression

Gets or sets the code expression to represent.

System_CAPS_pubpropertyUserData

Gets the user-definable data for the current object.(Inherited from CodeObject.)

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

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.

System_CAPS_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);

.NET Framework
Available since 1.1

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: