Επεξεργασία

Κοινή χρήση μέσω


CodeExpressionStatement Constructors

Definition

Initializes a new instance of the CodeExpressionStatement class.

Overloads

CodeExpressionStatement()

Initializes a new instance of the CodeExpressionStatement class.

CodeExpressionStatement(CodeExpression)

Initializes a new instance of the CodeExpressionStatement class by using the specified expression.

CodeExpressionStatement()

Source:
CodeExpressionStatement.cs
Source:
CodeExpressionStatement.cs
Source:
CodeExpressionStatement.cs
Source:
CodeExpressionStatement.cs

Initializes a new instance of the CodeExpressionStatement class.

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

Applies to

CodeExpressionStatement(CodeExpression)

Source:
CodeExpressionStatement.cs
Source:
CodeExpressionStatement.cs
Source:
CodeExpressionStatement.cs
Source:
CodeExpressionStatement.cs

Initializes a new instance of the CodeExpressionStatement class by using the specified expression.

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)

Parameters

expression
CodeExpression

A CodeExpression for the statement.

Examples

The following example creates a CodeExpression object and uses it as a parameter to initialize an instance of the CodeExpressionStatement class.

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

Applies to