Caprices

CodeEntryPointMethod

メンバ

コンストラクタ

public CodeEntryPointMethod();
概要
System.CodeDom.CodeEntryPointMethod クラスの新しいインスタンスを初期化します。

生成したものをそのままメンバに追加するとパラメータもないMainメソッドが追加される


// クラス作成
CodeTypeDeclaration ctd = new CodeTypeDeclaration( "CodeEntryPointMethodSample" );

// エントリポイント作成
CodeEntryPointMethod cepm = new CodeEntryPointMethod();

// メンバに追加
ctd.Members.Add( cepm );


//    public class CodeEntryPointMethodSample
//    {
//        
//        public static void Main()
//        {
//        }
//    }

▲ページ先頭へ

プロパティ

Attributes
メンバーの属性を取得または設定します。 (Inherited from CodeTypeMember )
Comments
型メンバーのコメント コレクションを取得します。 (Inherited from CodeTypeMember )
CustomAttributes
メンバーのカスタム属性を取得または設定します。 (Inherited from CodeTypeMember )
EndDirectives
メンバーの終了ディレクティブを取得します。 (Inherited from CodeTypeMember )
ImplementationTypes
メソッドの実装が PrivateImplementationType プロパティで示されるプライベート メソッド実装である場合を除き、このメソッドによって実装されるインターフェイスのデータ型を取得します。 (Inherited from CodeMemberMethod )
LinePragma
型メンバーのステートメントが発生する行を取得または設定します。 (Inherited from CodeTypeMember )
Name
メンバーの名前を取得または設定します。 (Inherited from CodeTypeMember )
Parameters
メソッドのパラメーター宣言を取得します。 (Inherited from CodeMemberMethod )
PrivateImplementationType
このメソッドによってプライベート メソッドが実装されるインターフェイスがある場合に、そのインターフェイスのデータ型を取得または設定します。 (Inherited from CodeMemberMethod )
ReturnType
メソッドの戻り値のデータ型を取得または設定します。 (Inherited from CodeMemberMethod )
ReturnTypeCustomAttributes
メソッドの戻り値の型のカスタム属性を取得します。 (Inherited from CodeMemberMethod )
StartDirectives
メンバーの開始ディレクティブを取得します。 (Inherited from CodeTypeMember )
Statements
メソッド内で、ステートメントを取得します。 (Inherited from CodeMemberMethod )
TypeParameters
現在のジェネリック メソッドの型パラメーターを取得します。 (Inherited from CodeMemberMethod )
UserData
現在のオブジェクトのユーザー定義可能なデータを取得します。 (Inherited from CodeObject )

▲ページ先頭へ

メソッド

Equals(Object)
指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。 (Inherited from Object)
GetHashCode()
既定のハッシュ関数として機能します。 (Inherited from Object)
GetType()
現在のインスタンスの Type を取得します。 (Inherited from Object)
MemberwiseClone()
現在の Object の簡易コピーを作成します。 (Inherited from Object)
ToString()
現在のオブジェクトを表す文字列を返します。 (Inherited from Object)

▲ページ先頭へ

イベント

PopulateImplementationTypes
ImplementationTypes コレクションが最初にアクセスされたときに発生するイベント。 (Inherited from CodeMemberMethod )
PopulateParameters
Parameters コレクションが最初にアクセスされたときに発生するイベント。 (Inherited from CodeMemberMethod )
PopulateStatements
Statements コレクションが最初にアクセスされたときに発生するイベント。 (Inherited from CodeMemberMethod )

▲ページ先頭へ

この例では、CodeEntryPointMethodをでプログラムの実行を開始する方法を示します。


// Builds a Hello World Program Graph using System.CodeDom objects
// System.CodeDomを使っているあいさつ世界プログラムグラフが反対する構造
public static CodeCompileUnit BuildHelloWorldGraph()
{
    // Create a new CodeCompileUnit to contain the program graph
    // プログラムグラフを含むように、新しいCodeCompileUnitを作成しなさい
    CodeCompileUnit CompileUnit = new CodeCompileUnit();

    // Declare a new namespace object and name it
    // 新しいnamespaceオブジェクトを宣言し、それを名付けなさい
    CodeNamespace Samples = new CodeNamespace("Samples");
    // Add the namespace object to the compile unit
    // namespaceオブジェクトを編集ユニットに追加しなさい

    CompileUnit.Namespaces.Add( Samples );

    // Add a new namespace import for the System namespace
    // システムnamespaceのための新しい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
    // 新しいタイプをnamespaceオブジェクトのタイプコレクションに追加しなさい
    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
        // System.Console.WriteLine方法を呼びなさい
        new CodeTypeReferenceExpression("System.Console"), "WriteLine",
        // Pass a primitive string parameter to the WriteLine method
        // 原始的なストリングパラメータをWriteLine方法に手渡しなさい
        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;
}

▲ページ先頭へ

定義


[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Serializable]
public class CodeEntryPointMethod : System.CodeDom.CodeMemberMethod

▲ページ先頭へ

クラス


#region アセンブリ System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// C:¥Program Files (x86)¥Reference Assemblies¥Microsoft¥Framework¥.NETFramework¥v4.6.1¥System.dll
#endregion

using System.Runtime.InteropServices;

namespace System.CodeDom
{
	//
	// 概要:
	//     実行可能ファイルのエントリ ポイント メソッドを表します。
	[ClassInterface( ClassInterfaceType.AutoDispatch )]
	[ComVisible( true )]
	public class CodeEntryPointMethod : CodeMemberMethod
	{
		//
		// 概要:
		//     System.CodeDom.CodeEntryPointMethod クラスの新しいインスタンスを初期化します。
		public CodeEntryPointMethod();
	}
}

▲ページ先頭へ