CodeVariableDeclarationStatement クラス
アセンブリ: System (system.dll 内)

<SerializableAttribute> _ <ComVisibleAttribute(True)> _ <ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _ Public Class CodeVariableDeclarationStatement Inherits CodeStatement
[SerializableAttribute] [ComVisibleAttribute(true)] [ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] public class CodeVariableDeclarationStatement : CodeStatement
[SerializableAttribute] [ComVisibleAttribute(true)] [ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] public ref class CodeVariableDeclarationStatement : public CodeStatement

CodeVariableDeclarationStatement を使用して、変数を宣言するコードを表すことができます。
Type プロパティは、宣言する変数の型を指定します。Name プロパティは、宣言する変数の名前を指定します。InitExpression プロパティは省略可能で、変数を作成した後に割り当てを行うための初期化式を指定します。
![]() |
---|

CodeVariableDeclarationStatement を使用して変数を宣言する例を次に示します。
Dim variableDeclaration As New CodeVariableDeclarationStatement( _ GetType(String), "TestString", _ New CodePrimitiveExpression("Testing")) ' The first two parameters indicate the type and name of the variable to declare. ' The optional initExpression parameter initializes the variable. ' A Visual Basic code generator produces the following source code for the preceeding example code: ' Dim TestString As String = "Testing"
CodeVariableDeclarationStatement variableDeclaration = new CodeVariableDeclarationStatement( // Type of the variable to declare. typeof(string), // Name of the variable to declare. "TestString", // Optional initExpression parameter initializes the variable. new CodePrimitiveExpression("Testing") ); // A C# code generator produces the following source code for the preceeding example code: // string TestString = "Testing";
// Type of the variable to declare. // Name of the variable to declare. // Optional initExpression parameter initializes the variable. CodeVariableDeclarationStatement^ variableDeclaration = gcnew CodeVariableDeclarationStatement( String::typeid,"TestString",gcnew CodePrimitiveExpression( "Testing" ) ); // A C# code generator produces the following source code for the preceeding example code: // string TestString = "Testing";
CodeVariableDeclarationStatement variableDeclaration = new CodeVariableDeclarationStatement( // Type of the variable to declare. String.class.ToType(), // Name of the variable to declare. "TestString", // Optional initExpression parameter initializes the variable. new CodePrimitiveExpression("Testing")); // A VJ# code generator produces the following source code for the // preceeding example code: // String testString = "Testing";

System.CodeDom.CodeObject
System.CodeDom.CodeStatement
System.CodeDom.CodeVariableDeclarationStatement


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からCodeVariableDeclarationStatement クラスを検索する場合は、下記のリンクをクリックしてください。

- CodeVariableDeclarationStatement クラスのページへのリンク