RuntimeEnvironment.FromGlobalAccessCache(Assembly) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
測試指定的組件是否會載入至全域組件快取。
public:
static bool FromGlobalAccessCache(System::Reflection::Assembly ^ a);
public static bool FromGlobalAccessCache (System.Reflection.Assembly a);
static member FromGlobalAccessCache : System.Reflection.Assembly -> bool
Public Shared Function FromGlobalAccessCache (a As Assembly) As Boolean
參數
- a
- Assembly
要測試的組件。
傳回
如果組件會載入至全域組件快取,則為 true
,否則為 false
。
範例
下列程式碼範例示範如何呼叫 FromGlobalAccessCache 方法。 此程式代碼範例是提供給 類別之較大範例的 RuntimeEnvironment 一部分。
// Show whether the EXE assembly was loaded from the GAC or from a
// private subdirectory.
Console::WriteLine("Did the {0} assembly load from the GAC? {1}",
Assembly::GetExecutingAssembly(),
RuntimeEnvironment::FromGlobalAccessCache(
Assembly::GetExecutingAssembly()));
// Show whether the EXE assembly was loaded from the GAC or from a private subdirectory.
Assembly assem = typeof(App).Assembly;
Console.WriteLine("Did the {0} assembly load from the GAC? {1}",
assem, RuntimeEnvironment.FromGlobalAccessCache(assem));
' Show whether the EXE assembly was loaded from the GAC or from a private subdirectory.
Dim assem As Assembly = GetType(App).Assembly
Console.WriteLine("Did the {0} assembly load from the GAC? {1}",
assem, RuntimeEnvironment.FromGlobalAccessCache(assem))