RuntimeEnvironment.FromGlobalAccessCache(Assembly) 方法
定义
测试是否将指定的程序集加载到全局程序集缓存中。Tests whether the specified assembly is loaded in the global assembly cache.
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
要测试的程序集。The assembly to test.
返回
如果程序集已加载到全局程序集缓存中,则为 true;否则为 false。true if the assembly is loaded in the global assembly cache; otherwise, false.
示例
下面的示例演示如何调用 FromGlobalAccessCache 方法。The following example demonstrates calling the FromGlobalAccessCache method. 此代码示例是为类提供的更大示例的一部分 RuntimeEnvironment 。This code example is part of a larger example provided for the RuntimeEnvironment class.
// 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))