CodeDirectionExpression CodeDirectionExpression CodeDirectionExpression CodeDirectionExpression Class

定義

代表做為叫用參數與參考方向指示器之方法的運算式。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
繼承
CodeDirectionExpressionCodeDirectionExpressionCodeDirectionExpressionCodeDirectionExpression
屬性

範例

下列範例示範如何使用CodeDirectionExpression來指定要當做方法參數傳遞之運算式的欄位方向修飾詞。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")

備註

CodeDirectionExpression可以代表傳遞至方法的參數和參數的參考方向。CodeDirectionExpression can represent a parameter passed to a method and the reference direction of the parameter.

Expression屬性會指出要以方向限定的運算式。The Expression property indicates the expression to qualify with a direction. 屬性會使用其中一個FieldDirection列舉值來指出參數的方向。 DirectionThe Direction property indicates the direction of the parameter using one of the FieldDirection enumeration values.

注意

CodeDirectionExpression是用來做為方法叫用參數, 不應在宣告方法時使用。CodeDirectionExpression is intended to be used as a method invoke parameter, and should not be used when declaring methods.

建構函式

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

初始化 CodeDirectionExpression 類別的新執行個體。Initializes a new instance of the CodeDirectionExpression class.

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

使用指定的欄位方向和運算式,來初始化 CodeDirectionExpression 類別的新執行個體。Initializes a new instance of the CodeDirectionExpression class using the specified field direction and expression.

屬性

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)

方法

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()

取得目前執行個體的 TypeGets the Type of the current instance.

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

建立目前 Object 的淺層複本 (Shallow Copy)。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)

適用於