CodeEntryPointMethod Osztály

Definíció

Egy végrehajtható belépési pont metódusát jelöli.

public ref class CodeEntryPointMethod : System::CodeDom::CodeMemberMethod
public 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
type CodeEntryPointMethod = class
    inherit 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
Öröklődés
Attribútumok

Példák

Ez a példa azt mutatja be, hogy a CodeEntryPointMethod program végrehajtásának indításának módszere a következő módon történik:

// 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

Megjegyzések

Az A CodeEntryPointMethod a CodeMemberMethod végrehajtható fájl belépési pontjának metódusát jelöli.

Konstruktorok

Name Description
CodeEntryPointMethod()

Inicializálja a CodeEntryPointMethod osztály új példányát.

Tulajdonságok

Name Description
Attributes

Lekéri vagy beállítja a tag attribútumait.

(Öröklődés forrása CodeTypeMember)
Comments

Lekéri a típustag megjegyzésgyűjteményét.

(Öröklődés forrása CodeTypeMember)
CustomAttributes

Lekéri vagy beállítja a tag egyéni attribútumait.

(Öröklődés forrása CodeTypeMember)
EndDirectives

Lekéri a tagra vonatkozó záró irányelveket.

(Öröklődés forrása CodeTypeMember)
ImplementationTypes

Lekéri a metódus által implementált interfészek adattípusait, kivéve, ha ez egy privát metódus implementációja, amelyet a PrivateImplementationType tulajdonság jelez.

(Öröklődés forrása CodeMemberMethod)
LinePragma

Lekéri vagy beállítja azt a sort, amelyen a típustag-utasítás történik.

(Öröklődés forrása CodeTypeMember)
Name

Lekéri vagy beállítja a tag nevét.

(Öröklődés forrása CodeTypeMember)
Parameters

Lekéri a metódus paraméterdeklarációit.

(Öröklődés forrása CodeMemberMethod)
PrivateImplementationType

Lekéri vagy beállítja az interfész adattípusát, ha privát, akkor implementál egy metódust, ha van ilyen.

(Öröklődés forrása CodeMemberMethod)
ReturnType

Lekéri vagy beállítja a metódus visszatérési értékének adattípusát.

(Öröklődés forrása CodeMemberMethod)
ReturnTypeCustomAttributes

Lekéri a metódus visszatérési típusának egyéni attribútumait.

(Öröklődés forrása CodeMemberMethod)
StartDirectives

Lekéri a kezdő irányelveket a tag számára.

(Öröklődés forrása CodeTypeMember)
Statements

Lekéri az utasításokat a metóduson belül.

(Öröklődés forrása CodeMemberMethod)
TypeParameters

Lekéri az aktuális általános metódus típusparamétereit.

(Öröklődés forrása CodeMemberMethod)
UserData

Lekéri az aktuális objektum felhasználó által definiálható adatait.

(Öröklődés forrása CodeObject)

Metódusok

Name Description
Equals(Object)

Meghatározza, hogy a megadott objektum egyenlő-e az aktuális objektummal.

(Öröklődés forrása Object)
GetHashCode()

Ez az alapértelmezett kivonatoló függvény.

(Öröklődés forrása Object)
GetType()

Lekéri az Type aktuális példányt.

(Öröklődés forrása Object)
MemberwiseClone()

Az aktuális Objectpéldány sekély másolatát hozza létre.

(Öröklődés forrása Object)
ToString()

Az aktuális objektumot jelképező sztringet ad vissza.

(Öröklődés forrása Object)

esemény

Name Description
PopulateImplementationTypes

Egy esemény, amely a gyűjtemény első elérésekor ImplementationTypes jelenik meg.

(Öröklődés forrása CodeMemberMethod)
PopulateParameters

Egy esemény, amely a gyűjtemény első elérésekor Parameters jelenik meg.

(Öröklődés forrása CodeMemberMethod)
PopulateStatements

Egy esemény, amely a gyűjtemény első elérésekor Statements jelenik meg.

(Öröklődés forrása CodeMemberMethod)

A következőre érvényes:

Lásd még