System.AppDomain.Load 方法 (AssemblyName, Evidence)

方法描述

在给定 AssemblyName 的情况下加载 Assembly。

语法定义(C# System.AppDomain.Load 方法 (AssemblyName, Evidence) 的用法)

[ObsoleteAttribute("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of Load which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public Assembly Load(
	AssemblyName assemblyRef,
	Evidence assemblySecurity
)

参数/返回值

参数值/返回值 参数类型/返回类型 参数描述/返回描述
assemblyRef System-Reflection-AssemblyName 描述要加载的程序集的对象。
assemblySecurity System-Security-Policy-Evidence 用于加载程序集的证据。
返回值 System.Reflection.Assembly 加载的程序集。

提示和注释

此方法只应用于将程序集加载到当前应用程序域中。 此方法为方便无法调用静态 Assembly.Load 方法的互操作调用方而提供。 要将程序集加载到其他应用程序域中年,请使用诸如 CreateInstanceAndUnwrap 的方法。

有关此方法的所有重载共有的信息,请参见 Load(AssemblyName) 方法重载。

System.AppDomain.Load 方法 (AssemblyName, Evidence)例子


异常

异常 异常描述
ArgumentNullException assemblyRef 为 null。
FileNotFoundException 未找到 assemblyRef。
BadImageFormatException
  • assemblyRef 不是有效程序集。
  • 当前加载的是 2.0 或更高版本的公共语言运行时,而 assemblyRef 是用更高版本的公共语言运行时编译的。
AppDomainUnloadedException 尝试对已卸载的应用程序域进行操作。
FileLoadException 用两个不同的证据将一个程序集或模块加载了两次。

命名空间

namespace: System

程序集: mscorlib(在 mscorlib.dll 中)

版本信息

.NET Framework 受以下版本支持:3.5、3.0、2.0、1.1、1.0 在 4 中过时(编译器警告) .NET Framework Client Profile 受以下版本支持:3.5 SP1 在 4 中过时(编译器警告)

适用平台

Windows 7, Windows Vista SP1 或更高版本, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008(不支持服务器核心), Windows Server 2008 R2(支持 SP1 或更高版本的服务器核心), Windows Server 2003 SP2 .NET Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。