CodeEntryPointMethod クラス

定義

実行可能ファイルのエントリ ポイント メソッドを表します。

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

この例では、 CodeEntryPointMethod を使用して、プログラムの実行を開始するメソッドを示します。

// Builds a Hello World Program Graph using System.CodeDom objects
public static CodeCompileUnit BuildHelloWorldGraph()
{
    // Create a new CodeCompileUnit to contain the program graph
    CodeCompileUnit CompileUnit = new CodeCompileUnit();

    // Declare a new namespace object and name it
    CodeNamespace Samples = new CodeNamespace("Samples");
    // Add the namespace object to the compile unit
    CompileUnit.Namespaces.Add( Samples );

    // Add a new namespace import for the System namespace
    Samples.Imports.Add( new CodeNamespaceImport("System") );

    // Declare a new type object and name it
    CodeTypeDeclaration Class1 = new CodeTypeDeclaration("Class1");
    // Add the new type to the namespace object's type collection
    Samples.Types.Add(Class1);

    // Declare a new code entry point method
    CodeEntryPointMethod Start = new CodeEntryPointMethod();
    // Create a new method invoke expression
    CodeMethodInvokeExpression cs1 = new CodeMethodInvokeExpression(
        // Call the System.Console.WriteLine method
        new CodeTypeReferenceExpression("System.Console"), "WriteLine",
        // Pass a primitive string parameter to the WriteLine method
        new CodePrimitiveExpression("Hello World!") );
    // Add the new method code statement
    Start.Statements.Add(new CodeExpressionStatement(cs1));

    // Add the code entry point method to the type's members collection
    Class1.Members.Add( Start );

    return CompileUnit;
' Builds a Hello World Program Graph using System.CodeDom objects
Public Shared Function BuildHelloWorldGraph() As CodeCompileUnit
   ' Create a new CodeCompileUnit to contain the program graph
   Dim CompileUnit As New CodeCompileUnit()
   
   ' Declare a new namespace object and name it
   Dim Samples As New CodeNamespace("Samples")
   ' Add the namespace object to the compile unit
   CompileUnit.Namespaces.Add(Samples)
   
   ' Add a new namespace import for the System namespace
   Samples.Imports.Add(New CodeNamespaceImport("System"))
   
   ' Declare a new type object and name it
   Dim Class1 As New CodeTypeDeclaration("Class1")
   ' Add the new type to the namespace object's type collection
   Samples.Types.Add(Class1)
   
   ' Declare a new code entry point method
   Dim Start As New CodeEntryPointMethod()
   ' Create a new method invoke expression
   Dim cs1 As New CodeMethodInvokeExpression(New CodeTypeReferenceExpression("System.Console"), "WriteLine", New CodePrimitiveExpression("Hello World!"))
   ' Call the System.Console.WriteLine method
   ' Pass a primitive string parameter to the WriteLine method
   ' Add the new method code statement
   Start.Statements.Add(New CodeExpressionStatement(cs1))
   
   ' Add the code entry point method to the type's members collection
   Class1.Members.Add(Start)
   
   Return CompileUnit

End Function 'BuildHelloWorldGraph

注釈

CodeEntryPointMethodは、実行可能ファイルのエントリ ポイント メソッドを表すCodeMemberMethodです。

コンストラクター

名前 説明
CodeEntryPointMethod()

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

プロパティ

名前 説明
Attributes

メンバーの属性を取得または設定します。

(継承元 CodeTypeMember)
Comments

型メンバーのコメントのコレクションを取得します。

(継承元 CodeTypeMember)
CustomAttributes

メンバーのカスタム属性を取得または設定します。

(継承元 CodeTypeMember)
EndDirectives

メンバーの終了ディレクティブを取得します。

(継承元 CodeTypeMember)
ImplementationTypes

PrivateImplementationType プロパティで示されるプライベート メソッドの実装でない限り、このメソッドによって実装されるインターフェイスのデータ型を取得します。

(継承元 CodeMemberMethod)
LinePragma

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

(継承元 CodeTypeMember)
Name

メンバーの名前を取得または設定します。

(継承元 CodeTypeMember)
Parameters

メソッドのパラメーター宣言を取得します。

(継承元 CodeMemberMethod)
PrivateImplementationType

プライベートの場合、このメソッドが実装するインターフェイスのデータ型 (ある場合) を取得または設定します。

(継承元 CodeMemberMethod)
ReturnType

メソッドの戻り値のデータ型を取得または設定します。

(継承元 CodeMemberMethod)
ReturnTypeCustomAttributes

メソッドの戻り値の型のカスタム属性を取得します。

(継承元 CodeMemberMethod)
StartDirectives

メンバーの開始ディレクティブを取得します。

(継承元 CodeTypeMember)
Statements

メソッド内のステートメントを取得します。

(継承元 CodeMemberMethod)
TypeParameters

現在のジェネリック メソッドの型パラメーターを取得します。

(継承元 CodeMemberMethod)
UserData

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

(継承元 CodeObject)

メソッド

名前 説明
Equals(Object)

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

(継承元 Object)
GetHashCode()

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

(継承元 Object)
GetType()

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

(継承元 Object)
MemberwiseClone()

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

(継承元 Object)
ToString()

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

(継承元 Object)

イベント

名前 説明
PopulateImplementationTypes

ImplementationTypes コレクションに初めてアクセスされるときに発生するイベント。

(継承元 CodeMemberMethod)
PopulateParameters

Parameters コレクションに初めてアクセスされるときに発生するイベント。

(継承元 CodeMemberMethod)
PopulateStatements

Statements コレクションに初めてアクセスされるときに発生するイベント。

(継承元 CodeMemberMethod)

適用対象

こちらもご覧ください