RuntimeEnvironment.FromGlobalAccessCache(Assembly) 方法

定义

测试是否在全局程序集缓存中加载指定的程序集。

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))

适用于