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


VB.NET AppDomain.ReflectionOnlyGetAssemblies方法代碼示例

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


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

示例1: Example

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

Public Class Example
    
    Public Shared Sub Main() 
        ' Get the assembly display name for System.dll, the assembly 
        ' that contains System.Timers.Timer. Note that this causes
        ' System.dll to be loaded into the execution context.
        '
        Dim displayName As String = GetType(Timer).Assembly.FullName
        
        ' Load System.dll into the reflection-only context. Note that 
        ' if you obtain the display name (for example, by running this
        ' example program), and enter it as a literal string in the 
        ' preceding line of code, you can load System.dll into the 
        ' reflection-only context without loading it into the execution 
        ' context.
        Assembly.ReflectionOnlyLoad(displayName)
        
        ' Display the assemblies loaded into the execution and 
        ' reflection-only contexts. System.dll appears in both contexts.
        '
        Dim ad As AppDomain = AppDomain.CurrentDomain
        Console.WriteLine("------------- Execution Context --------------")
        For Each a As Assembly In ad.GetAssemblies()
            Console.WriteLine(vbTab + "{0}", a.GetName())
        Next a
        Console.WriteLine("------------- Reflection-only Context --------------")
        For Each a As Assembly In ad.ReflectionOnlyGetAssemblies()
            Console.WriteLine(vbTab + "{0}", a.GetName())
        Next a
    
    End Sub
End Class
開發者ID:VB.NET開發者,項目名稱:System,代碼行數:36,代碼來源:AppDomain.ReflectionOnlyGetAssemblies


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