共用方式為


Assembly.Load 方法

定義

裝載一個組件。

多載

名稱 Description
Load(Byte[], Byte[], SecurityContextSource)

載入一個基於通用物件檔案格式(COFF)的影像,包含已發射的組件,並可選擇包含符號並指定安全上下文的來源。

Load(Byte[], Byte[], Evidence)
已淘汰.

載入一個基於通用物件檔案格式(COFF)的影像,包含已發射的組裝體,並可選擇性地包含該組件的符號與證據。

Load(String, Evidence)
已淘汰.

載入一個組件,根據顯示名稱並使用提供的證據。

Load(AssemblyName, Evidence)
已淘汰.

給定其 AssemblyName。 組件是根據提供的證據進行載入。

Load(Byte[])

載入一個基於通用物件檔案格式(COFF)的影像,包含一個已發射的組裝體。

Load(String)

載入一個指定名稱的組裝體。

Load(AssemblyName)

給定其 AssemblyName

Load(Byte[], Byte[])

載入一個基於通用物件檔案格式(COFF)的影像,包含已發射的組裝體,並可選擇包含組裝套件的符號。

Load(Byte[], Byte[], SecurityContextSource)

載入一個基於通用物件檔案格式(COFF)的影像,包含已發射的組件,並可選擇包含符號並指定安全上下文的來源。

public:
 static System::Reflection::Assembly ^ Load(cli::array <System::Byte> ^ rawAssembly, cli::array <System::Byte> ^ rawSymbolStore, System::Security::SecurityContextSource securityContextSource);
public static System.Reflection.Assembly Load(byte[] rawAssembly, byte[] rawSymbolStore, System.Security.SecurityContextSource securityContextSource);
static member Load : byte[] * byte[] * System.Security.SecurityContextSource -> System.Reflection.Assembly
Public Shared Function Load (rawAssembly As Byte(), rawSymbolStore As Byte(), securityContextSource As SecurityContextSource) As Assembly

參數

rawAssembly
Byte[]

一個位元組陣列,是一個基於 COFF 的映像,包含一個已發射的組裝體。

rawSymbolStore
Byte[]

一個位元組陣列,包含代表組合語言符號的原始位元組。

securityContextSource
SecurityContextSource

安全上下文的來源。

傳回

裝填組件。

例外狀況

rawAssemblynull

rawAssembly 在目前載入的執行時中,不是一個有效的組合語言。

securityContextSource 值並非列舉值之一。

備註

組合語言會依據指定的安全上下文來源,載入呼叫者的應用程式域。 若 rawSymbolStore 指定了,代表組合語言符號的原始位元組也會被載入。

適用於

Load(Byte[], Byte[], Evidence)

警告

This method is 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.

載入一個基於通用物件檔案格式(COFF)的影像,包含已發射的組裝體,並可選擇性地包含該組件的符號與證據。

public:
 static System::Reflection::Assembly ^ Load(cli::array <System::Byte> ^ rawAssembly, cli::array <System::Byte> ^ rawSymbolStore, System::Security::Policy::Evidence ^ securityEvidence);
public static System.Reflection.Assembly Load(byte[] rawAssembly, byte[] rawSymbolStore, System.Security.Policy.Evidence securityEvidence);
[System.Obsolete("This method is 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 static System.Reflection.Assembly Load(byte[] rawAssembly, byte[] rawSymbolStore, System.Security.Policy.Evidence securityEvidence);
static member Load : byte[] * byte[] * System.Security.Policy.Evidence -> System.Reflection.Assembly
[<System.Obsolete("This method is 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.")>]
static member Load : byte[] * byte[] * System.Security.Policy.Evidence -> System.Reflection.Assembly
Public Shared Function Load (rawAssembly As Byte(), rawSymbolStore As Byte(), securityEvidence As Evidence) As Assembly

參數

rawAssembly
Byte[]

一個位元組陣列,是一個基於 COFF 的映像,包含一個已發射的組裝體。

rawSymbolStore
Byte[]

一個位元組陣列,包含代表組合語言符號的原始位元組。

securityEvidence
Evidence

裝填組件的證據。

傳回

裝填組件。

屬性

例外狀況

rawAssemblynull

rawAssembly 在目前載入的執行時中,不是一個有效的組合語言。

一個組件或模組會載入兩次,並攜帶兩種不同的證據。

securityEvidence 不是 null。 預設情況下,.NET Framework 4 並未啟用舊有 CAS 政策;當未啟用時,必須 securityEvidencenull

備註

此方法過載總是在其獨立的載入上下文中產生新的 Assembly 物件。

組件是根據提供的證據進行載入。 代表組合語言符號的原始位元組也會被載入。

是否授予或不授予某程序集特定許可權是基於證據的。 組裝與安全證據合併的規則如下:

  • 當你使用 LoadEvidence 參數的方法時,裝配體會被載入載入器所提供的證據。

  • 當你使用 Load 帶有 Evidence 參數的方法時,證據片段會被合併。 作為方法 Load 論據所提供的證據,會取代裝載員提供的證據。

  • 當你使用 Load 帶有 Byte[] 參數的方法過載載入 COFF 映像時,證據會繼承自呼叫的組件。

  • 當你使用 Load 帶有 Byte[] 參數的方法並 Evidence 載入 COFF 影像時,僅使用提供的證據。 召喚集會的證據和 COFF 影像的證據被忽略。

如果你在同一組語言上呼叫 Load 該方法多次,但指定不同的證據,通用語言執行時不會拋出 a FileLoadException ,因為無法確定不同證據規格的相等性與完整性。 最先成功的證據就是所使用的證據。

適用於

Load(String, Evidence)

警告

This method is 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:
 static System::Reflection::Assembly ^ Load(System::String ^ assemblyString, System::Security::Policy::Evidence ^ assemblySecurity);
public static System.Reflection.Assembly Load(string assemblyString, System.Security.Policy.Evidence assemblySecurity);
[System.Obsolete("This method is 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 static System.Reflection.Assembly Load(string assemblyString, System.Security.Policy.Evidence assemblySecurity);
static member Load : string * System.Security.Policy.Evidence -> System.Reflection.Assembly
[<System.Obsolete("This method is 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.")>]
static member Load : string * System.Security.Policy.Evidence -> System.Reflection.Assembly
Public Shared Function Load (assemblyString As String, assemblySecurity As Evidence) As Assembly

參數

assemblyString
String

集合的顯示名稱。

assemblySecurity
Evidence

裝填組件的證據。

傳回

裝填組件。

屬性

例外狀況

assemblyStringnull

找不到 assemblyString

assemblyString 在目前載入的執行時中,不是一個有效的組合語言。

找到的檔案無法載入。

-或-

一個組件或模組會載入兩次,並攜帶兩種不同的證據。

備註

FileLoadExceptionassemblyString 指定完整組合名稱,且第一個與簡單名稱相符的組合語言版本、文化或公開金鑰標記不同,則會拋出。 載入器不會繼續探測其他符合簡單名稱的組件。

是否授予或不授予某程序集特定許可權是基於證據的。 組裝與安全證據合併的規則如下:

  • 當你使用 LoadEvidence 參數的方法時,裝配體會被載入載入器所提供的證據。

  • 當你使用 Load 帶有 Evidence 參數的方法時,證據片段會被合併。 作為方法 Load 論據所提供的證據,會取代裝載員提供的證據。

  • 當你使用 Load 帶有 Byte[] 參數的方法過載來載入通用物件檔案格式(COFF)映像時,證據會從呼叫的組合語言繼承。

  • 當你使用 Load 帶有 Byte[] 參數的方法並 Evidence 載入 COFF 影像時,僅使用提供的證據。 召喚集會的證據和 COFF 影像的證據被忽略了。

如果你在同一組語言上多次呼叫此方法,但指定不同的證據,則通用語言執行時間不會拋出 a FileLoadException ,因為無法確定不同證據規格的相等性與完整性。 最先成功的證據就是所使用的證據。

在 .NET Framework 2.0 版本中,處理器架構被加入組合語言識別碼,並可作為組合語言名稱字串的一部分來指定。 例如,「ProcessorArchitecture=msil」。 然而,建議的組合名稱指定方式是建立一個 AssemblyName 物件,並將其傳達給適當的方法過載 Load 。 參見 AssemblyName.ProcessorArchitecture

另請參閱

適用於

Load(AssemblyName, Evidence)

警告

This method is 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.

給定其 AssemblyName。 組件是根據提供的證據進行載入。

public:
 static System::Reflection::Assembly ^ Load(System::Reflection::AssemblyName ^ assemblyRef, System::Security::Policy::Evidence ^ assemblySecurity);
public static System.Reflection.Assembly Load(System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity);
[System.Obsolete("This method is 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 static System.Reflection.Assembly Load(System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity);
static member Load : System.Reflection.AssemblyName * System.Security.Policy.Evidence -> System.Reflection.Assembly
[<System.Obsolete("This method is 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.")>]
static member Load : System.Reflection.AssemblyName * System.Security.Policy.Evidence -> System.Reflection.Assembly
Public Shared Function Load (assemblyRef As AssemblyName, assemblySecurity As Evidence) As Assembly

參數

assemblyRef
AssemblyName

描述要裝載的組件的物件。

assemblySecurity
Evidence

裝填組件的證據。

傳回

裝填組件。

屬性

例外狀況

assemblyRefnull

找不到 assemblyRef

assemblyRef 在目前載入的執行時中,不是一個有效的組合語言。

一個組件或模組會載入兩次,並攜帶兩種不同的證據。

-或-

assemblyRef 指定一個根據 <loadFromRemoteSources> 被停用的位置。

備註

FileLoadExceptionassemblyRef 指定完整組合名稱,且第一個與簡單名稱相符的組合語言版本、文化或公開金鑰標記不同,則會拋出。 載入器不會繼續探測其他符合簡單名稱的組件。

請參閱 <loadFromRemoteSources> 從遠端地區裝載組件的資訊。

備註

不要只用屬性CodeBase集來使用 aAssemblyName。 該 CodeBase 屬性不提供組裝身分的任何元素(如名稱或版本),因此載入並非依照身份載入規則進行,這與該方法所預期 Load 的關係不同。 組裝則是依照載入規則(load-from)來載入。 關於使用 load-from(載入點)上下文的缺點,請參閱 Assembly.LoadFrom 方法過載或組裝 裝載最佳實務

是否授予或不授予某程序集特定許可權是基於證據的。 組裝與安全證據合併的規則如下:

  • 當你使用 LoadEvidence 參數的方法時,裝配體會被載入載入器所提供的證據。

  • 當你使用 Load 帶有 Evidence 參數的方法時,證據片段會被合併。 作為方法 Load 論據所提供的證據,會取代裝載員提供的證據。

  • 當你使用 Load 帶有 Byte[] 參數的方法過載來載入通用物件檔案格式(COFF)映像時,證據會從呼叫的組合語言繼承。

  • 當你使用 Load 帶有 Byte[] 參數的方法並 Evidence 載入 COFF 影像時,僅使用提供的證據。 召喚集會的證據和 COFF 影像的證據被忽略了。

備註

如果屬性與屬性都AssemblyName.NameAssemblyName.CodeBase被設定,第一次載入組合語言時會使用顯示名稱(包括屬性回傳Assembly.FullName的版本、文化等)。 若找不到該檔案, CodeBase 則用於搜尋該組合。 若該組件以 CodeBase找到,則顯示名稱與組件相匹配。 若配對失敗,則擲出 a FileLoadException

如果你在同一組語言上呼叫 Load 該方法多次,但指定不同的證據,通用語言執行時不會拋出 a FileLoadException ,因為無法確定不同證據規格的相等性與完整性。 最先成功的證據就是所使用的證據。

另請參閱

適用於

Load(Byte[])

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

載入一個基於通用物件檔案格式(COFF)的影像,包含一個已發射的組裝體。

public:
 static System::Reflection::Assembly ^ Load(cli::array <System::Byte> ^ rawAssembly);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly Load(byte[] rawAssembly);
public static System.Reflection.Assembly Load(byte[] rawAssembly);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")>]
static member Load : byte[] -> System.Reflection.Assembly
static member Load : byte[] -> System.Reflection.Assembly
Public Shared Function Load (rawAssembly As Byte()) As Assembly

參數

rawAssembly
Byte[]

一個位元組陣列,是一個基於 COFF 的映像,包含一個已發射的組裝體。

傳回

裝填組件。

屬性

例外狀況

rawAssemblynull

rawAssembly 在目前載入的執行時中,不是一個有效的組合語言。

備註

此方法過載總是在其獨立的載入上下文中產生新的 Assembly 物件。

僅限 .NET Framework: 使用此方法載入的組合語言的信任等級與呼叫組件的信任等級相同。 若要從具有應用程式領域信任等級的位元組陣列載入組合語言,請使用 Load(Byte[], Byte[], SecurityContextSource) 方法過載。 關於使用帶有位元組陣列的超載Load證據的更多資訊,請參見方法過載。Load(Byte[], Byte[], Evidence)

適用於

Load(String)

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

載入一個指定名稱的組裝體。

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

參數

assemblyString
String

議會名稱的長短形式。

傳回

裝填組件。

例外狀況

assemblyStringnull

assemblyString 是一條零長度的字串。

找不到 assemblyString

找到的檔案無法載入。

assemblyString 在目前載入的執行時中,不是一個有效的組合語言。

範例

以下範例載入一個組件,給定其完全限定名稱,並列出該組件中所有類型。 關於如何取得完全合格的議會名稱,請參閱議會名稱。

using System;
using System.Reflection;

class Class1
{
    public static void Main()
    {
        // You must supply a valid fully qualified assembly name.
        Assembly SampleAssembly = Assembly.Load
            ("SampleAssembly, Version=1.0.2004.0, Culture=neutral, PublicKeyToken=8744b20f8da049e3");
        // Display all the types contained in the specified assembly.
        foreach (Type oType in SampleAssembly.GetTypes()) {
            Console.WriteLine(oType.Name);
        }
    }
}
Imports System.Reflection

Class Class1
    Public Shared Sub Main()
        ' You must supply a valid fully qualified assembly name.
        Dim SampleAssembly As [Assembly] = _
            [Assembly].Load("SampleAssembly, Version=1.0.2004.0, Culture=neutral, PublicKeyToken=8744b20f8da049e3")
        Dim oType As Type
        ' Display all the types contained in the specified assembly.
        For Each oType In SampleAssembly.GetTypes()
            Console.WriteLine(oType.Name)
        Next oType
    End Sub	'LoadSample
End Class

備註

在 .NET Core/.NET 5+ 中,目標組合會載入目前 AssemblyLoadContextAssemblyLoadContext.CurrentContextualReflectionContext 設定在上下文中。 欲了解更多組裝裝載資訊,請參閱 管理組裝裝載演算法

為了載入正確的組裝,建議透過傳遞組裝名稱的長形式來呼叫該 Load 方法。 組合名稱的長形式包含其簡單名稱(例如 System.dll 組合語言的「System」),以及版本、文化、公鑰標記,以及可選的處理器架構。 它對應於組裝 FullName 的財產。 以下範例說明使用長名稱載入 .NET Framework 4 的 System.dll assembly:

using System;
using System.Reflection;

public class Example
{
   public static void Main()
   {
      string longName = "system, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
      Assembly assem = Assembly.Load(longName);
      if (assem == null)
         Console.WriteLine("Unable to load assembly...");
      else
         Console.WriteLine(assem.FullName);
   }
}
// The example displays the following output:
//        system, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Imports System.Reflection

Module Example
   Public Sub Main()
      Dim longName As String = "system, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
      Dim assem As Assembly = Assembly.Load(longName)
      If assem Is Nothing Then
         Console.WriteLine("Unable to load assembly...")
      Else
         Console.WriteLine(assem.FullName)
      End If
   End Sub
End Module
' The example displays the following output:
'       system, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

FileLoadExceptionassemblyString 指定完整組合名稱,且第一個與簡單名稱相符的組合語言版本、文化或公開金鑰標記不同,則會拋出。 載入器不會繼續探測其他符合簡單名稱的組件。

在 .NET Framework 2.0 版本中,處理器架構被加入組合語言識別碼,並可作為組合語言名稱字串的一部分來指定。 例如,「ProcessorArchitecture=msil」。 然而,建議的組合名稱指定方式是建立一個 AssemblyName 物件,並將其傳達給適當的方法過載 Load 。 參見 AssemblyName.ProcessorArchitecture

另請參閱

適用於

Load(AssemblyName)

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

給定其 AssemblyName

public:
 static System::Reflection::Assembly ^ Load(System::Reflection::AssemblyName ^ assemblyRef);
public static System.Reflection.Assembly Load(System.Reflection.AssemblyName assemblyRef);
static member Load : System.Reflection.AssemblyName -> System.Reflection.Assembly
Public Shared Function Load (assemblyRef As AssemblyName) As Assembly

參數

assemblyRef
AssemblyName

描述要裝載的組件的物件。

傳回

裝填組件。

例外狀況

assemblyRefnull

找不到 assemblyRef

找到的檔案無法載入。

-或-

僅限 .NET Framework 使用:assemblyRef根據 loadFromRemoteSources> 指定一個被停用<的位置。

注意:在 .NET for Windows Store 應用程式Portable 類別函式庫中,請擷取基底類別例外, IOException為 。

assemblyRef 在目前載入的執行時中,不是一個有效的組合語言。

範例

以下範例實例化一個 AssemblyName 物件,並用它來載入 sysglobal.dll 組裝。 範例接著顯示集合公共型態的全名。

using System;
using System.Reflection;

public class Example
{
   public static void Main()
   {
      String fullName = "sysglobl, Version=4.0.0.0, Culture=neutral, " +
                        "PublicKeyToken=b03f5f7f11d50a3a, processor architecture=MSIL";
      var an = new AssemblyName(fullName);
      var assem = Assembly.Load(an);
      Console.WriteLine("Public types in assembly {0}:", assem.FullName);
      foreach (var t in assem.GetTypes())
         if (t.IsPublic)
            Console.WriteLine("   {0}", t.FullName);
   }
}
// The example displays the following output:
//   Public types in assembly sysglobl, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a:
//      System.Globalization.CultureAndRegionInfoBuilder
//      System.Globalization.CultureAndRegionModifiers
Imports System.Reflection

Module Example
   Public Sub Main()
      Dim fullName As String = "sysglobl, Version=4.0.0.0, Culture=neutral, " +
                               "PublicKeyToken=b03f5f7f11d50a3a, processor architecture=MSIL"
      Dim an As New AssemblyName(fullName)
      Dim assem As Assembly = Assembly.Load(an)
      Console.WriteLine("Public types in assembly {0}:", assem.FullName)
      For Each t As Type in assem.GetTypes()
         If t.IsPublic Then Console.WriteLine("   {0}", t.FullName)
      Next
   End Sub
End Module

' The example displays the following output:
'   Public types in assembly sysglobl, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a:
'      System.Globalization.CultureAndRegionInfoBuilder
'      System.Globalization.CultureAndRegionModifiers

備註

在 .NET Core/.NET 5+ 中,目標組合會載入目前 AssemblyLoadContextAssemblyLoadContext.CurrentContextualReflectionContext 設定在上下文中。 欲了解更多組裝裝載資訊,請參閱 管理組裝裝載演算法

備註

僅限 .NET Framework: 關於從遠端地點裝載組件的資訊,請參見 <loadFromRemoteSources>

備註

僅限 .NET Framework:不要只用屬性CodeBase集來使用 aAssemblyName。 該 CodeBase 屬性不提供組裝身分的任何元素(如名稱或版本),因此載入並非依照身份載入規則進行,這與該方法所預期 Load 的關係不同。 組裝則是依照載入規則(load-from)來載入。 關於使用 load-from(載入點)上下文的缺點,請參閱 Assembly.LoadFrom 方法過載或組裝 裝載最佳實務

備註

僅限 .NET Framework:如果屬性與屬性都AssemblyName.NameAssemblyName.CodeBase被設定,第一次載入組合語言時會使用顯示名稱(包括屬性回傳Assembly.FullName的版本、文化等)。 若找不到該檔案, CodeBase 則用於搜尋該組合。 若該組件以 CodeBase找到,則顯示名稱與組件相匹配。 若配對失敗,則擲出 a FileLoadException

另請參閱

適用於

Load(Byte[], Byte[])

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

載入一個基於通用物件檔案格式(COFF)的影像,包含已發射的組裝體,並可選擇包含組裝套件的符號。

public:
 static System::Reflection::Assembly ^ Load(cli::array <System::Byte> ^ rawAssembly, cli::array <System::Byte> ^ rawSymbolStore);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")]
public static System.Reflection.Assembly Load(byte[] rawAssembly, byte[]? rawSymbolStore);
public static System.Reflection.Assembly Load(byte[] rawAssembly, byte[] rawSymbolStore);
public static System.Reflection.Assembly Load(byte[] rawAssembly, byte[]? rawSymbolStore);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Types and members the loaded assembly depends on might be removed")>]
static member Load : byte[] * byte[] -> System.Reflection.Assembly
static member Load : byte[] * byte[] -> System.Reflection.Assembly
Public Shared Function Load (rawAssembly As Byte(), rawSymbolStore As Byte()) As Assembly

參數

rawAssembly
Byte[]

一個位元組陣列,是一個基於 COFF 的映像,包含一個已發射的組裝體。

rawSymbolStore
Byte[]

一個位元組陣列,包含代表組合語言符號的原始位元組。

傳回

裝填組件。

屬性

例外狀況

rawAssemblynull

rawAssembly 在目前載入的執行時中,不是一個有效的組合語言。

備註

在 .NET Core/5+ 中,目標組件會載入目前 AssemblyLoadContext的 . 欲了解更多組裝裝載資訊,請參閱 管理組裝裝載演算法

此方法過載總是在其獨立的載入上下文中產生新的 Assembly 物件。

僅限 .NET Framework: 使用此方法載入的組合語言的信任等級與呼叫組件的信任等級相同。 若要從具有應用程式領域信任等級的位元組陣列載入組合語言,請使用 Load(Byte[], Byte[], SecurityContextSource) 方法過載。 關於使用帶有位元組陣列的超載Load證據的更多資訊,請參見方法過載。Load(Byte[], Byte[], Evidence)

適用於