CodeAssignStatement 類別

定義

表示簡單的指派陳述式 (Assignment Statement)。

public ref class CodeAssignStatement : System::CodeDom::CodeStatement
public class CodeAssignStatement : System.CodeDom.CodeStatement
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeAssignStatement : System.CodeDom.CodeStatement
type CodeAssignStatement = class
    inherit CodeStatement
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeAssignStatement = class
    inherit CodeStatement
Public Class CodeAssignStatement
Inherits CodeStatement
繼承
CodeAssignStatement
屬性

範例

下列程式代碼會建立 , CodeAssignStatement 將值 10 指派給名為 的 i 整數變數:

// Assigns the value of the 10 to the integer variable "i".
CodeAssignStatement^ as1 = gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "i" ),gcnew CodePrimitiveExpression( 10 ) );

// A C# code generator produces the following source code for the preceeding example code:
// i=10;
// Assigns the value of the 10 to the integer variable "i".
CodeAssignStatement as1 = new CodeAssignStatement(new CodeVariableReferenceExpression("i"), new CodePrimitiveExpression(10));

// A C# code generator produces the following source code for the preceeding example code:

// i=10;
' Assigns the value 10 to the integer variable "i".
Dim as1 As New CodeAssignStatement(New CodeVariableReferenceExpression("i"), New CodePrimitiveExpression(10))

' A Visual Basic code generator produces the following source code for the preceeding example code:

' i = 10

備註

CodeAssignStatement 可用來表示將物件值指派給另一個對象的語句,或是另一個參考的參考。 簡單指派語句的格式通常是 “ ” value1 = value2 ,其中 value1 是指派的物件,而且 value2 正在指派。 屬性 Left 會指出要指派給的物件。 屬性 Right 會指出要指派的物件。

建構函式

CodeAssignStatement()

初始化 CodeAssignStatement 類別的新執行個體。

CodeAssignStatement(CodeExpression, CodeExpression)

使用指定的運算式來初始化 CodeAssignStatement 類別的新執行個體。

屬性

EndDirectives

取得包含結尾指示詞的 CodeDirectiveCollection 物件。

(繼承來源 CodeStatement)
Left

取得或設定表示要指派之物件或參考的運算式。

LinePragma

取得或設定程式碼陳述式發生所在的行。

(繼承來源 CodeStatement)
Right

取得或設定指派物件或參考的運算式。

StartDirectives

取得包含開頭指示詞的 CodeDirectiveCollection 物件。

(繼承來源 CodeStatement)
UserData

取得目前物件的使用者可定義資料。

(繼承來源 CodeObject)

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於