本文整理汇总了VB.NET中System.CodeDom.CodeEntryPointMethod类的典型用法代码示例。如果您正苦于以下问题:VB.NET CodeEntryPointMethod类的具体用法?VB.NET CodeEntryPointMethod怎么用?VB.NET CodeEntryPointMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CodeEntryPointMethod类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: BuildHelloWorldGraph
' 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