本文整理汇总了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