Assembly.ReflectionOnlyLoad Assembly.ReflectionOnlyLoad Assembly.ReflectionOnlyLoad Assembly.ReflectionOnlyLoad Method

定義

將組件載入僅限反映的內容中,以便在其中檢查組件但不執行組件。Loads an assembly into the reflection-only context, where it can be examined but not executed.

多載

ReflectionOnlyLoad(Byte[]) ReflectionOnlyLoad(Byte[]) ReflectionOnlyLoad(Byte[]) ReflectionOnlyLoad(Byte[])

從以通用物件檔案格式 (COFF) 為基礎的映像 (包含發出的組件) 載入組件。Loads the assembly from a common object file format (COFF)-based image containing an emitted assembly. 這個組件會載入呼叫端應用程式定義域之僅限反映的內容中。The assembly is loaded into the reflection-only context of the caller's application domain.

ReflectionOnlyLoad(String) ReflectionOnlyLoad(String) ReflectionOnlyLoad(String) ReflectionOnlyLoad(String)

將組件載入僅限反映的內容中,並指定其顯示名稱。Loads an assembly into the reflection-only context, given its display name.

ReflectionOnlyLoad(Byte[]) ReflectionOnlyLoad(Byte[]) ReflectionOnlyLoad(Byte[]) ReflectionOnlyLoad(Byte[])

從以通用物件檔案格式 (COFF) 為基礎的映像 (包含發出的組件) 載入組件。Loads the assembly from a common object file format (COFF)-based image containing an emitted assembly. 這個組件會載入呼叫端應用程式定義域之僅限反映的內容中。The assembly is loaded into the reflection-only context of the caller's application domain.

public:
 static System::Reflection::Assembly ^ ReflectionOnlyLoad(cli::array <System::Byte> ^ rawAssembly);
public static System.Reflection.Assembly ReflectionOnlyLoad (byte[] rawAssembly);
static member ReflectionOnlyLoad : byte[] -> System.Reflection.Assembly
Public Shared Function ReflectionOnlyLoad (rawAssembly As Byte()) As Assembly

參數

rawAssembly
Byte[]

位元組陣列,該陣列是以 COFF 為基礎的影像,其中包含發出的組件。A byte array that is a COFF-based image containing an emitted assembly.

傳回

載入的組件。The loaded assembly.

例外狀況

rawAssembly 不是有效的組件。rawAssembly is not a valid assembly.

-或--or- 目前載入的是通用語言執行平台 2.0 版或更新版本,且已使用更新的版本來編譯 rawAssemblyVersion 2.0 or later of the common language runtime is currently loaded and rawAssembly was compiled with a later version.

無法載入 rawAssemblyrawAssembly cannot be loaded.

僅限 .NET Core:不支援此成員。.NET Core only: This member is not supported.

備註

您無法從載入僅限反映之內容的元件執行程式碼。You cannot execute code from an assembly loaded into the reflection-only context. 若要執行程式碼,您也必須使用Load方法,將元件載入至執行內容。To execute code, the assembly must be loaded into the execution context as well, using the Load method.

僅限反映的內容與其他內容並無不同。The reflection-only context is no different from other contexts. 載入內容中的元件只能藉由卸載應用程式域來卸載。Assemblies that are loaded into the context can be unloaded only by unloading the application domain.

ReflectionOnlyLoad(String) ReflectionOnlyLoad(String) ReflectionOnlyLoad(String) ReflectionOnlyLoad(String)

將組件載入僅限反映的內容中,並指定其顯示名稱。Loads an assembly into the reflection-only context, given its display name.

public:
 static System::Reflection::Assembly ^ ReflectionOnlyLoad(System::String ^ assemblyString);
public static System.Reflection.Assembly ReflectionOnlyLoad (string assemblyString);
static member ReflectionOnlyLoad : string -> System.Reflection.Assembly
Public Shared Function ReflectionOnlyLoad (assemblyString As String) As Assembly

參數

assemblyString
String String String String

組件的顯示名稱,如同 FullName 屬性所傳回。The display name of the assembly, as returned by the FullName property.

傳回

載入的組件。The loaded assembly.

例外狀況

assemblyString 為空字串 ("")。assemblyString is an empty string ("").

找不到 assemblyStringassemblyString is not found.

找到 assemblyString,但無法載入。assemblyString is found, but cannot be loaded.

assemblyString 不是有效的組件。assemblyString is not a valid assembly.

-或--or- 目前載入的是通用語言執行平台 2.0 版或更新版本,且已使用更新的版本來編譯 assemblyStringVersion 2.0 or later of the common language runtime is currently loaded and assemblyString was compiled with a later version.

僅限 .NET Core:不支援此成員。.NET Core only: This member is not supported.

備註

相依性不會自動載入到僅限反映的內容中。Dependencies are not automatically loaded into the reflection-only context.

您無法從載入僅限反映之內容的元件執行程式碼。You cannot execute code from an assembly loaded into the reflection-only context. 若要執行程式碼,您也必須使用Load方法,將元件載入至執行內容。To execute code, the assembly must be loaded into the execution context as well, using the Load method.

是否將某些使用權限授予組件則以辨識項 (Evidence) 為基礎。Whether certain permissions are granted or not granted to an assembly is based on evidence. 元件和安全性辨識項合併的規則如下所示:The rules for assembly and security evidence merging are as follows:

注意

在中C++編譯的可執行檔上反映FileLoadException可能會擲回。Reflecting on executable files compiled in C++ might throw a FileLoadException. 這很可能是因為C++編譯器從可執行檔中去除重新配置位址或 reloc 區段所造成。This is most likely caused by the C++ compiler stripping the relocation addresses or the .reloc section from your executable file. 若要保留 reloc 位址,請指定/fixed:no您要連結的時間。To preserve the .reloc address, specify /fixed:no when you are linking.

僅限反映的內容與其他內容並無不同。The reflection-only context is no different from other contexts. 載入內容中的元件只能藉由卸載應用程式域來卸載。Assemblies that are loaded into the context can be unloaded only by unloading the application domain.

適用於