This documentation is archived and is not being maintained.
CodeEntryPointMethod Class
Visual Studio 2008
Represents the entry point method of an executable.
Assembly: System (in System.dll)
A CodeEntryPointMethod is a CodeMemberMethod that represents the entry point method of an executable.
This example demonstrates using a CodeEntryPointMethod to indicate the method to start program execution at.
' 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
System.Object
System.CodeDom.CodeObject
System.CodeDom.CodeTypeMember
System.CodeDom.CodeMemberMethod
System.CodeDom.CodeEntryPointMethod
System.CodeDom.CodeObject
System.CodeDom.CodeTypeMember
System.CodeDom.CodeMemberMethod
System.CodeDom.CodeEntryPointMethod
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: