CodeExpressionStatement 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 CodeExpressionStatement 類別的新執行個體。
多載
CodeExpressionStatement() |
初始化 CodeExpressionStatement 類別的新執行個體。 |
CodeExpressionStatement(CodeExpression) |
使用指定的運算式來初始化 CodeExpressionStatement 類別的新執行個體。 |
CodeExpressionStatement()
初始化 CodeExpressionStatement 類別的新執行個體。
public:
CodeExpressionStatement();
public CodeExpressionStatement ();
Public Sub New ()
適用於
CodeExpressionStatement(CodeExpression)
使用指定的運算式來初始化 CodeExpressionStatement 類別的新執行個體。
public:
CodeExpressionStatement(System::CodeDom::CodeExpression ^ expression);
public CodeExpressionStatement (System.CodeDom.CodeExpression expression);
new System.CodeDom.CodeExpressionStatement : System.CodeDom.CodeExpression -> System.CodeDom.CodeExpressionStatement
Public Sub New (expression As CodeExpression)
參數
- expression
- CodeExpression
陳述式的 CodeExpression。
範例
下列範例會 CodeExpression 建立 物件,並將它當做參數來初始化 類別的 CodeExpressionStatement 實例。
// Creates a code expression for a CodeExpressionStatement to contain.
array<CodeExpression^>^ temp = {gcnew CodePrimitiveExpression( "Example string" )};
CodeExpression^ invokeExpression = gcnew CodeMethodInvokeExpression(
gcnew CodeTypeReferenceExpression( "Console" ),"Write",temp );
// Creates a statement using a code expression.
CodeExpressionStatement^ expressionStatement;
expressionStatement = gcnew CodeExpressionStatement( invokeExpression );
// A C++ code generator produces the following source code for the preceeding example code:
// Console::Write( "Example string" );
// Creates a code expression for a CodeExpressionStatement to contain.
CodeExpression invokeExpression = new CodeMethodInvokeExpression(
new CodeTypeReferenceExpression("Console"),
"Write", new CodePrimitiveExpression("Example string") );
// Creates a statement using a code expression.
CodeExpressionStatement expressionStatement;
expressionStatement = new CodeExpressionStatement( invokeExpression );
// A C# code generator produces the following source code for the preceeding example code:
// Console.Write( "Example string" );
' Creates a code expression for a CodeExpressionStatement to contain.
Dim invokeExpression = New CodeMethodInvokeExpression( _
New CodeTypeReferenceExpression("Console"), "Write", _
New CodePrimitiveExpression("Example string"))
' Creates a statement using a code expression.
Dim expressionStatement As CodeExpressionStatement
expressionStatement = New CodeExpressionStatement(invokeExpression)
' A C# code generator produces the following source code for the preceeding example code:
' Console.Write( "Example string" );