CodeAssignStatement CodeAssignStatement CodeAssignStatement CodeAssignStatement Class

定義

表示簡單的指派陳述式 (Assignment Statement)。Represents a simple assignment statement.

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

範例

下列CodeAssignStatement程式碼會建立, 將值10指派給名為i的整數變數:The following code creates a CodeAssignStatement that assigns the value 10 to an integer variable named 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可以用來表示將物件的值指派給另一個物件的語句, 或另一個參考的參考。CodeAssignStatement can be used to represent a statement that assigns the value of an object to another object, or a reference to another reference. 簡單指派語句的格式通常value1為 " = value2 ", 其中value1是要指派給的物件, 而且value2會被指派。Simple assignment statements are usually of the form " value1 = value2 ", where value1 is the object being assigned to, and value2 is being assigned. Left屬性會指出要指派給的物件。The Left property indicates the object to assign to. Right屬性會指出要指派的物件。The Right property indicates the object to assign.

建構函式

CodeAssignStatement() CodeAssignStatement() CodeAssignStatement() CodeAssignStatement()

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

CodeAssignStatement(CodeExpression, CodeExpression) CodeAssignStatement(CodeExpression, CodeExpression) CodeAssignStatement(CodeExpression, CodeExpression) CodeAssignStatement(CodeExpression, CodeExpression)

使用指定的運算式來初始化 CodeAssignStatement 類別的新執行個體。Initializes a new instance of the CodeAssignStatement class using the specified expressions.

屬性

EndDirectives EndDirectives EndDirectives EndDirectives

取得包含結尾指示詞的 CodeDirectiveCollection 物件。Gets a CodeDirectiveCollection object that contains end directives.

(Inherited from CodeStatement)
Left Left Left Left

取得或設定表示要指派之物件或參考的運算式。Gets or sets the expression representing the object or reference to assign to.

LinePragma LinePragma LinePragma LinePragma

取得或設定程式碼陳述式發生所在的行。Gets or sets the line on which the code statement occurs.

(Inherited from CodeStatement)
Right Right Right Right

取得或設定指派物件或參考的運算式。Gets or sets the expression representing the object or reference to assign.

StartDirectives StartDirectives StartDirectives StartDirectives

取得包含開頭指示詞的 CodeDirectiveCollection 物件。Gets a CodeDirectiveCollection object that contains start directives.

(Inherited from CodeStatement)
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)

適用於