Assembly.GetEntryAssembly 方法

定義

取得預設應用程式定義域中的處理序可執行檔。Gets the process executable in the default application domain. 在其他應用程式定義域中,這是由 ExecuteAssembly(String) 執行的第一個可執行檔。In other application domains, this is the first executable that was executed by ExecuteAssembly(String).

public:
 static System::Reflection::Assembly ^ GetEntryAssembly();
public static System.Reflection.Assembly GetEntryAssembly ();
static member GetEntryAssembly : unit -> System.Reflection.Assembly
Public Shared Function GetEntryAssembly () As Assembly

傳回

Assembly

組件,該組件是預設應用程式定義域中的處理序可執行檔,或是由 ExecuteAssembly(String) 執行的第一個可執行檔。The assembly that is the process executable in the default application domain, or the first executable that was executed by ExecuteAssembly(String). 從 Unmanaged 程式碼呼叫時,可能會傳回 nullCan return null when called from unmanaged code.

備註

GetEntryAssembly null 從非受控的應用程式載入 managed 元件時,方法可能會傳回。The GetEntryAssembly method can return null when a managed assembly has been loaded from an unmanaged application. 例如,如果未受管理的應用程式建立以 c # 撰寫的 COM 元件實例,則 GetEntryAssembly 從 c # 元件呼叫方法會傳回 null,因為進程的進入點是非受控的程式碼,而不是 managed 元件。For example, if an unmanaged application creates an instance of a COM component written in C#, a call to the GetEntryAssembly method from the C# component returns null, because the entry point for the process was unmanaged code rather than a managed assembly.

適用於