CodeExpressionStatement Costruttori

Definizione

Inizializza una nuova istanza della classe CodeExpressionStatement.

Overload

CodeExpressionStatement()

Inizializza una nuova istanza della classe CodeExpressionStatement.

CodeExpressionStatement(CodeExpression)

Inizializza una nuova istanza della classe CodeExpressionStatement utilizzando l'espressione specificata.

CodeExpressionStatement()

Origine:
CodeExpressionStatement.cs
Origine:
CodeExpressionStatement.cs
Origine:
CodeExpressionStatement.cs

Inizializza una nuova istanza della classe CodeExpressionStatement.

public:
 CodeExpressionStatement();
public CodeExpressionStatement ();
Public Sub New ()

Si applica a

CodeExpressionStatement(CodeExpression)

Origine:
CodeExpressionStatement.cs
Origine:
CodeExpressionStatement.cs
Origine:
CodeExpressionStatement.cs

Inizializza una nuova istanza della classe CodeExpressionStatement utilizzando l'espressione specificata.

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)

Parametri

expression
CodeExpression

CodeExpression per l'istruzione.

Esempio

L'esempio seguente crea un oggetto e lo usa come parametro per inizializzare un'istanza CodeExpression della CodeExpressionStatement classe.

// 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" );

Si applica a