Export (0) Print
Expand All

CodeAssignStatement Class

Represents a simple assignment statement.

For a list of all members of this type, see CodeAssignStatement Members.

System.Object
   System.CodeDom.CodeObject
      System.CodeDom.CodeStatement
         System.CodeDom.CodeAssignStatement

[Visual Basic]
<Serializable>
<ClassInterface(ClassInterfaceType.AutoDispatch)>
<ComVisible(True)>
Public Class CodeAssignStatement
   Inherits CodeStatement
[C#]
[Serializable]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ComVisible(true)]
public class CodeAssignStatement : CodeStatement
[C++]
[Serializable]
[ClassInterface(ClassInterfaceType::AutoDispatch)]
[ComVisible(true)]
public __gc class CodeAssignStatement : public CodeStatement
[JScript]
public
   Serializable
 ClassInterface(ClassInterfaceType.AutoDispatch)
 ComVisible(true)
class CodeAssignStatement extends CodeStatement

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

CodeAssignStatement can be used to represent a statement that assigns the value of an object to another object, or a reference to another reference. Simple assignment statements are usually of the form " value1 = value2 ", where value1 is the object being assigned to, and value2 is being assigned. The Left property indicates the object to assign to. The Right property indicates the object to assign.

Example

[Visual Basic, C#, C++] The following code creates a CodeAssignStatement that assigns the value 10 to an integer variable named i:

[Visual Basic] 
' 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

[C#] 
// 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;

[C++] 
// Assigns the value of the 10 to the integer variable "i".
CodeAssignStatement* as1 = new CodeAssignStatement(new CodeVariableReferenceExpression(S"i"), new CodePrimitiveExpression(__box(10)));

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

// i=10;

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter 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)

See Also

CodeAssignStatement Members | System.CodeDom Namespace

Show:
© 2014 Microsoft