本文整理匯總了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
示例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
輸出:
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
輸出:
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