Assembly.ReflectionOnlyLoad 方法

定義

將組件載入僅限反映的內容中,以便在其中檢查組件但不執行組件。

多載

ReflectionOnlyLoad(Byte[])
已淘汰.

從以通用物件檔案格式 (COFF) 為基礎的映像 (包含發出的組件) 載入組件。 這個組件會載入呼叫端應用程式定義域之僅限反映的內容中。

ReflectionOnlyLoad(String)
已淘汰.

將組件載入僅限反映的內容中,並指定其顯示名稱。

ReflectionOnlyLoad(Byte[])

來源:
Assembly.cs
來源:
Assembly.cs
來源:
Assembly.cs

警告

ReflectionOnly loading is not supported and throws PlatformNotSupportedException.

從以通用物件檔案格式 (COFF) 為基礎的映像 (包含發出的組件) 載入組件。 這個組件會載入呼叫端應用程式定義域之僅限反映的內容中。

C#
public static System.Reflection.Assembly ReflectionOnlyLoad(byte[] rawAssembly);
C#
[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);

參數

rawAssembly
Byte[]

位元組陣列,該陣列是以 COFF 為基礎的影像,其中包含發出的組件。

傳回

載入的組件。

屬性

例外狀況

rawAssemblynull

rawAssembly 不是目前載入運行時間的有效元件。

無法載入 rawAssembly

僅限 .NET Core 與 .NET 5+:在所有情況下。

備註

您無法從載入至僅限反映內容的元件執行程式代碼。 若要執行程序代碼,也必須使用 Load 方法將元件載入執行內容。

僅限反映的內容與其他內容並無不同。 載入內容中的元件只能卸除應用程式域來卸除。

適用於

.NET 9 和其他版本
產品 版本 (已過時)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5 (6, 7, 8, 9)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

ReflectionOnlyLoad(String)

來源:
Assembly.cs
來源:
Assembly.cs
來源:
Assembly.cs

警告

ReflectionOnly loading is not supported and throws PlatformNotSupportedException.

將組件載入僅限反映的內容中,並指定其顯示名稱。

C#
public static System.Reflection.Assembly ReflectionOnlyLoad(string assemblyString);
C#
[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);

參數

assemblyString
String

組件的顯示名稱,如同 FullName 屬性所傳回。

傳回

載入的組件。

屬性

例外狀況

assemblyStringnull

assemblyString 為空字串 ("")。

找不到 assemblyString

找到 assemblyString,但無法載入。

assemblyString 不是目前載入運行時間的有效元件。

僅限 .NET Core 與 .NET 5+:在所有情況下。

備註

相依性不會自動載入僅限反映的內容。

您無法從載入至僅限反映內容的元件執行程式代碼。 若要執行程序代碼,也必須使用 Load 方法將元件載入執行內容。

僅限反映的內容與其他內容並無不同。 載入內容中的元件只能卸除應用程式域來卸除。

適用於

.NET 9 和其他版本
產品 版本 (已過時)
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5 (6, 7, 8, 9)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1