Bagikan melalui


CodeExpressionStatement Konstruktor

Definisi

Menginisialisasi instans baru kelas CodeExpressionStatement.

Overload

CodeExpressionStatement()

Menginisialisasi instans baru kelas CodeExpressionStatement.

CodeExpressionStatement(CodeExpression)

Menginisialisasi instans CodeExpressionStatement baru kelas dengan menggunakan ekspresi yang ditentukan.

CodeExpressionStatement()

Sumber:
CodeExpressionStatement.cs
Sumber:
CodeExpressionStatement.cs
Sumber:
CodeExpressionStatement.cs

Menginisialisasi instans baru kelas CodeExpressionStatement.

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

Berlaku untuk

CodeExpressionStatement(CodeExpression)

Sumber:
CodeExpressionStatement.cs
Sumber:
CodeExpressionStatement.cs
Sumber:
CodeExpressionStatement.cs

Menginisialisasi instans CodeExpressionStatement baru kelas dengan menggunakan ekspresi yang ditentukan.

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)

Parameter

expression
CodeExpression

A CodeExpression untuk pernyataan.

Contoh

Contoh berikut membuat CodeExpression objek dan menggunakannya sebagai parameter untuk menginisialisasi instans CodeExpressionStatement kelas.

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

Berlaku untuk