Assembly.ReflectionOnlyLoad 方法

定义

将程序集加载到只反射上下文中,在只反射上下文中可以检查但不能执行程序集。

重载

ReflectionOnlyLoad(Byte[])
已过时.

加载来自基于通用对象文件格式 (COFF) 的映像的程序集,该映像包含已发出的程序集。 程序集被加载到调用方的应用程序域的只反射上下文中。

ReflectionOnlyLoad(String)
已过时.

将给定显示名称的程序集加载到只反射上下文中。

ReflectionOnlyLoad(Byte[])

Source:
Assembly.cs
Source:
Assembly.cs
Source:
Assembly.cs

注意

ReflectionOnly loading is not supported and throws PlatformNotSupportedException.

加载来自基于通用对象文件格式 (COFF) 的映像的程序集,该映像包含已发出的程序集。 程序集被加载到调用方的应用程序域的只反射上下文中。

public:
 static System::Reflection::Assembly ^ ReflectionOnlyLoad(cli::array <System::Byte> ^ rawAssembly);
public static System.Reflection.Assembly ReflectionOnlyLoad (byte[] rawAssembly);
[System.Obsolete("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId="SYSLIB0018", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Reflection.Assembly ReflectionOnlyLoad (byte[] rawAssembly);
static member ReflectionOnlyLoad : byte[] -> System.Reflection.Assembly
[<System.Obsolete("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId="SYSLIB0018", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member ReflectionOnlyLoad : byte[] -> System.Reflection.Assembly
Public Shared Function ReflectionOnlyLoad (rawAssembly As Byte()) As Assembly

参数

rawAssembly
Byte[]

字节数组,它是包含已发出程序集的基于 COFF 的映像。

返回

加载的程序集。

属性

例外

rawAssemblynull

rawAssembly 不是当前加载的运行时的有效程序集。

无法加载 rawAssembly

仅限 .NET Core 和 .NET 5 及更高版本:在所有情况下。

注解

不能从加载到仅反射上下文中的程序集执行代码。 若要执行代码,还必须使用 Load 方法将程序集加载到执行上下文中。

仅反射上下文与其他上下文没有什么不同。 加载到上下文中的程序集只能通过卸载应用程序域来卸载。

适用于

ReflectionOnlyLoad(String)

Source:
Assembly.cs
Source:
Assembly.cs
Source:
Assembly.cs

注意

ReflectionOnly loading is not supported and throws PlatformNotSupportedException.

将给定显示名称的程序集加载到只反射上下文中。

public:
 static System::Reflection::Assembly ^ ReflectionOnlyLoad(System::String ^ assemblyString);
public static System.Reflection.Assembly ReflectionOnlyLoad (string assemblyString);
[System.Obsolete("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId="SYSLIB0018", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Reflection.Assembly ReflectionOnlyLoad (string assemblyString);
static member ReflectionOnlyLoad : string -> System.Reflection.Assembly
[<System.Obsolete("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId="SYSLIB0018", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member ReflectionOnlyLoad : string -> System.Reflection.Assembly
Public Shared Function ReflectionOnlyLoad (assemblyString As String) As Assembly

参数

assemblyString
String

程序集的显示名称,由 FullName 属性返回。

返回

加载的程序集。

属性

例外

assemblyStringnull

assemblyString 为空字符串 ("")。

assemblyString 未找到。

assemblyString 已找到,但无法加载。

assemblyString 不是当前加载的运行时的有效程序集。

仅限 .NET Core 和 .NET 5 及更高版本:在所有情况下。

注解

依赖项不会自动加载到仅反射上下文中。

不能从加载到仅反射上下文中的程序集执行代码。 若要执行代码,还必须使用 Load 方法将程序集加载到执行上下文中。

仅反射上下文与其他上下文没有什么不同。 加载到上下文中的程序集只能通过卸载应用程序域来卸载。

适用于