CodeExpressionStatement クラス

定義

1 つの式で構成されるステートメントを表します。

public ref class CodeExpressionStatement : System::CodeDom::CodeStatement
public class CodeExpressionStatement : System.CodeDom.CodeStatement
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeExpressionStatement : System.CodeDom.CodeStatement
type CodeExpressionStatement = class
    inherit CodeStatement
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeExpressionStatement = class
    inherit CodeStatement
Public Class CodeExpressionStatement
Inherits CodeStatement
継承
CodeExpressionStatement
属性

次の例では、CodeExpressionStatement オブジェクトを使用して、CodeExpression クラスのインスタンスを作成する方法を示します。

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

注釈

CodeExpressionStatementにはCodeExpression オブジェクトが含まれており、CodeStatementCollection オブジェクトに追加できるため、一部の式を単独で使用できます。 たとえば、CodeMethodInvokeExpressionに含まれるCodeExpressionStatementは、戻り値のないメソッド呼び出しを表すことができます。

コンストラクター

名前 説明
CodeExpressionStatement()

CodeExpressionStatement クラスの新しいインスタンスを初期化します。

CodeExpressionStatement(CodeExpression)

指定した式を使用して、 CodeExpressionStatement クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
EndDirectives

終了ディレクティブを含む CodeDirectiveCollection オブジェクトを取得します。

(継承元 CodeStatement)
Expression

ステートメントの式を取得または設定します。

LinePragma

コード ステートメントが発生する行を取得または設定します。

(継承元 CodeStatement)
StartDirectives

開始ディレクティブを含む CodeDirectiveCollection オブジェクトを取得します。

(継承元 CodeStatement)
UserData

現在のオブジェクトのユーザー定義可能なデータを取得します。

(継承元 CodeObject)

メソッド

名前 説明
Equals(Object)

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象