當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET Assembly.Load方法代碼示例

本文整理匯總了VB.NET中System.Reflection.Assembly.Load方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET Assembly.Load方法的具體用法?VB.NET Assembly.Load怎麽用?VB.NET Assembly.Load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Reflection.Assembly的用法示例。


在下文中一共展示了Assembly.Load方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: Class1

' 導入命名空間
Imports System.Reflection

Class Class1
    Public Shared Sub Main()
        ' You must supply a valid fully qualified assembly name.            
        Dim SampleAssembly As [Assembly] = _
            [Assembly].Load("SampleAssembly, Version=1.0.2004.0, Culture=neutral, PublicKeyToken=8744b20f8da049e3")
        Dim oType As Type
        ' Display all the types contained in the specified assembly.
        For Each oType In SampleAssembly.GetTypes()
            Console.WriteLine(oType.Name)
        Next oType
    End Sub	'LoadSample
End Class
開發者ID:VB.NET開發者,項目名稱:System.Reflection,代碼行數:15,代碼來源:Assembly.Load

示例2: Example

' 導入命名空間
Imports System.Reflection

Module Example
   Public Sub Main()
      Dim longName As String = "system, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
      Dim assem As Assembly = Assembly.Load(longName)
      If assem Is Nothing Then
         Console.WriteLine("Unable to load assembly...")
      Else
         Console.WriteLine(assem.FullName)
      End If
   End Sub
End Module
開發者ID:VB.NET開發者,項目名稱:System.Reflection,代碼行數:14,代碼來源:Assembly.Load

輸出:

system, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

示例3: Example

' 導入命名空間
Imports System.Reflection

Module Example
   Public Sub Main()
      Dim fullName As String = "sysglobl, Version=4.0.0.0, Culture=neutral, " +
                               "PublicKeyToken=b03f5f7f11d50a3a, processor architecture=MSIL"
      Dim an As New AssemblyName(fullName)
      Dim assem As Assembly = Assembly.Load(an)
      Console.WriteLine("Public types in assembly {0}:", assem.FullName)
      For Each t As Type in assem.GetTypes()
         If t.IsPublic Then Console.WriteLine("   {0}", t.FullName)
      Next
   End Sub
End Module
開發者ID:VB.NET開發者,項目名稱:System.Reflection,代碼行數:15,代碼來源:Assembly.Load

輸出:

Public types in assembly sysglobl, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a:
System.Globalization.CultureAndRegionInfoBuilder
System.Globalization.CultureAndRegionModifiers

示例4: MainClass

' 導入命名空間
Imports System
Imports System.Reflection

 
Public Class MainClass

    Shared Sub Main(  )
         Dim a As [Assembly] = [Assembly].Load("Mscorlib.dll")
         Dim theTypes As Type(  ) = a.GetTypes(  )
         Dim t As Type
         For Each t In theTypes
             Console.WriteLine("Type is {0}", t)
         Next t
         Console.WriteLine("{0} types found", theTypes.Length)

    End Sub
  
End Class
開發者ID:VB程序員,項目名稱:System.Reflection,代碼行數:19,代碼來源:Assembly.Load


注:本文中的System.Reflection.Assembly.Load方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。