home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2005 June (DVD) / DPPRO0605DVD.iso / dotNETSDK / SETUP.EXE / netfxsd1.cab / FL_TestEmittedAssembly_vb________.3643236F_FC70_11D3_A536_0090278A1BB8 < prev    next >
Encoding:
Text File  |  2001-08-21  |  1.5 KB  |  44 lines

  1. 
  2. '=====================================================================
  3. '  File:      TestEmittedAssembly.vb
  4. '
  5. '  Summary:   Demonstrates how to use reflection emit.
  6. '
  7. '---------------------------------------------------------------------
  8. '  This file is part of the Microsoft .NET SDK Code Samples.
  9. '
  10. '  Copyright (C) Microsoft Corporation.  All rights reserved.
  11. '
  12. 'This source code is intended only as a supplement to Microsoft
  13. 'Development Tools and/or on-line documentation.  See these other
  14. 'materials for detailed information regarding Microsoft code samples.
  15. '
  16. 'THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  17. 'KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  18. 'IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  19. 'PARTICULAR PURPOSE.
  20. '=====================================================================
  21.  
  22. Option Strict On
  23. Option Explicit On
  24.  
  25.  
  26. Imports System
  27.  
  28.  
  29. Public Class App
  30.     Public Shared Sub Main()
  31.       Try
  32.          UseHelloWorld()
  33.       Catch e As System.TypeLoadException
  34.          Console.WriteLine("Unable to load HelloWorld type " & _
  35.             "from EmittedAssembly.dll!\nExecute EmitAssembly " & _
  36.             "with option 2 from the command line to build the assembly.")
  37.       End Try
  38.     End Sub 'Main
  39.  
  40.     Private Shared Sub UseHelloWorld()
  41.        Dim h As New HelloWorld("HelloWorld!")
  42.        Console.WriteLine(h.GetGreeting())
  43.     End Sub 'UseHelloWorld
  44. End Class 'App