다음을 통해 공유


CodeExpressionStatement 생성자

정의

CodeExpressionStatement 클래스의 새 인스턴스를 초기화합니다.

오버로드

CodeExpressionStatement()

CodeExpressionStatement 클래스의 새 인스턴스를 초기화합니다.

CodeExpressionStatement(CodeExpression)

지정된 식을 사용하여 CodeExpressionStatement 클래스의 새 인스턴스를 초기화합니다.

CodeExpressionStatement()

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

CodeExpressionStatement 클래스의 새 인스턴스를 초기화합니다.

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

적용 대상

CodeExpressionStatement(CodeExpression)

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

지정된 식을 사용하여 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 instance 초기화합니다.

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

적용 대상