単純な代入ステートメントを表します。
名前空間: System.CodeDom
アセンブリ: System (system.dll 内)
構文
'宣言
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
Public Class CodeAssignStatement
Inherits CodeStatement
'使用
Dim instance As CodeAssignStatement
[SerializableAttribute]
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
public class CodeAssignStatement : CodeStatement
[SerializableAttribute]
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)]
public ref class CodeAssignStatement : public CodeStatement
/** @attribute SerializableAttribute() */
/** @attribute ComVisibleAttribute(true) */
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */
public class CodeAssignStatement extends CodeStatement
SerializableAttribute
ComVisibleAttribute(true)
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)
public class CodeAssignStatement extends CodeStatement
解説
CodeAssignStatement を使用して、オブジェクトの値を別のオブジェクトに代入するステートメントや、参照を別の参照に代入するステートメントを表すことができます。単純な代入ステートメントの通常の書式は "value1 = value2" です。value1 は代入先のオブジェクトであり、value2 は代入されるオブジェクトです。Left プロパティが、代入先のオブジェクトを示します。Right プロパティが、代入するオブジェクトを示します。
使用例
値 10 を i という名前の整数変数に代入する CodeAssignStatement を作成するコードを次に示します。
' 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
// 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 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((Int32)10));
// A VJ# code generator produces the following source code for the
// preceeding example code:
// i=10;
継承階層
System.Object
System.CodeDom.CodeObject
System.CodeDom.CodeStatement
System.CodeDom.CodeAssignStatement
スレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 2.0、1.1、1.0