Share via


CodeEntryPointMethod Sınıf

Tanım

Yürütülebilir dosyanın giriş noktası yöntemini temsil eder.

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
Devralma
Öznitelikler

Örnekler

Bu örnekte, program yürütmeyi başlatma yöntemini belirtmek için bir CodeEntryPointMethod kullanımı gösterilmektedir.

// Builds a Hello World Program Graph using System.CodeDom objects
static CodeCompileUnit^ BuildHelloWorldGraph()
{
   
   // Create a new CodeCompileUnit to contain the program graph
   CodeCompileUnit^ CompileUnit = gcnew CodeCompileUnit;
   
   // Declare a new namespace object and name it
   CodeNamespace^ Samples = gcnew 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( gcnew CodeNamespaceImport( "System" ) );
   
   // Declare a new type object and name it
   CodeTypeDeclaration^ Class1 = gcnew 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 = gcnew CodeEntryPointMethod;
   
   // Create a new method invoke expression
   array<CodeExpression^>^temp = {gcnew CodePrimitiveExpression( "Hello World!" )};
   CodeMethodInvokeExpression^ cs1 = gcnew CodeMethodInvokeExpression( gcnew CodeTypeReferenceExpression( "System.Console" ),"WriteLine",temp );
   
   // Add the new method code statement
   Start->Statements->Add( gcnew 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 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

Açıklamalar

A CodeEntryPointMethod , yürütülebilir dosyanın CodeMemberMethod giriş noktası yöntemini temsil eden bir yöntemdir.

Oluşturucular

CodeEntryPointMethod()

CodeEntryPointMethod sınıfının yeni bir örneğini başlatır.

Özellikler

Attributes

Üyenin özniteliklerini alır veya ayarlar.

(Devralındığı yer: CodeTypeMember)
Comments

Tür üyesi için açıklama koleksiyonunu alır.

(Devralındığı yer: CodeTypeMember)
CustomAttributes

Üyenin özel özniteliklerini alır veya ayarlar.

(Devralındığı yer: CodeTypeMember)
EndDirectives

Üyenin bitiş yönergelerini alır.

(Devralındığı yer: CodeTypeMember)
ImplementationTypes

Özelliği tarafından belirtilen PrivateImplementationType özel bir yöntem uygulaması olmadığı sürece, bu yöntem tarafından uygulanan arabirimlerin veri türlerini alır.

(Devralındığı yer: CodeMemberMethod)
LinePragma

Tür üye deyiminin oluştuğu satırı alır veya ayarlar.

(Devralındığı yer: CodeTypeMember)
Name

Üyenin adını alır veya ayarlar.

(Devralındığı yer: CodeTypeMember)
Parameters

yöntemi için parametre bildirimlerini alır.

(Devralındığı yer: CodeMemberMethod)
PrivateImplementationType

Bu yöntemin veri türünü alır veya ayarlar, özelse, varsa bir yöntemi uygular.

(Devralındığı yer: CodeMemberMethod)
ReturnType

Yönteminin dönüş değerinin veri türünü alır veya ayarlar.

(Devralındığı yer: CodeMemberMethod)
ReturnTypeCustomAttributes

yönteminin dönüş türünün özel özniteliklerini alır.

(Devralındığı yer: CodeMemberMethod)
StartDirectives

Üye için başlangıç yönergelerini alır.

(Devralındığı yer: CodeTypeMember)
Statements

yönteminin içindeki deyimleri alır.

(Devralındığı yer: CodeMemberMethod)
TypeParameters

Geçerli genel yöntemin tür parametrelerini alır.

(Devralındığı yer: CodeMemberMethod)
UserData

Geçerli nesne için kullanıcı tarafından tanımlanabilir verileri alır.

(Devralındığı yer: CodeObject)

Yöntemler

Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
GetHashCode()

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetType()

Type Geçerli örneğini alır.

(Devralındığı yer: Object)
MemberwiseClone()

Geçerli Objectöğesinin sığ bir kopyasını oluşturur.

(Devralındığı yer: Object)
ToString()

Geçerli nesneyi temsil eden dizeyi döndürür.

(Devralındığı yer: Object)

Ekinlikler

PopulateImplementationTypes

Koleksiyona ilk kez ImplementationTypes erişildiğinde tetiklenecek bir olay.

(Devralındığı yer: CodeMemberMethod)
PopulateParameters

Koleksiyona ilk kez Parameters erişildiğinde tetiklenecek bir olay.

(Devralındığı yer: CodeMemberMethod)
PopulateStatements

Koleksiyona ilk kez Statements erişildiğinde tetiklenecek bir olay.

(Devralındığı yer: CodeMemberMethod)

Şunlara uygulanır

Ayrıca bkz.