本文整理汇总了VB.NET中System.Reflection.Assembly.GetExecutingAssembly方法的典型用法代码示例。如果您正苦于以下问题:VB.NET Assembly.GetExecutingAssembly方法的具体用法?VB.NET Assembly.GetExecutingAssembly怎么用?VB.NET Assembly.GetExecutingAssembly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.Assembly
的用法示例。
在下文中一共展示了Assembly.GetExecutingAssembly方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Example
' 导入命名空间
Imports System.Reflection
Public Module Example
Public Sub Main()
' Get the assembly from a known type in that assembly.
Dim t As Type = GetType(Example)
Dim assemFromType As Assembly = t.Assembly
Console.WriteLine("Assembly that contains Example:")
Console.WriteLine(" {0}", assemFromType.FullName)
Console.WriteLine()
' Get the currently executing assembly.
Dim currentAssem As Assembly = Assembly.GetExecutingAssembly()
Console.WriteLine("Currently executing assembly:")
Console.WriteLine(" {0}", currentAssem.FullName)
Console.WriteLine()
Console.WriteLine("The two Assembly objects are equal: {0}",
assemFromType.Equals(currentAssem))
End Sub
End Module
输出:
Assembly that contains Example: GetExecutingAssembly1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null Currently executing assembly: GetExecutingAssembly1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null The two Assembly objects are equal: True
示例2: Main
' 导入命名空间
Imports System.Reflection
Module Example
Public Sub Main()
Dim assem As Assembly = GetType(Example).Assembly
Console.WriteLine("Assembly name: {0}", assem.FullName)
End Sub
End Module
输出:
Assembly name: Assembly1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
示例3: Assembly.GetExecutingAssembly()
' 导入命名空间
Imports System.Reflection
Class A
End Class
Class B
End Class
Class C
End Class
Class D
End Class
Public Class MainClass
Public Shared Sub Main()
Dim ThisAssembly As [Assembly] = [Assembly].GetExecutingAssembly()
Dim TypeObj As Type
For Each TypeObj In ThisAssembly.GetTypes()
Console.WriteLine(TypeObj.Name)
Next
End Sub
End Class