Assembly.GetEntryAssembly 方法

定义

获取默认应用程序域中的进程可执行文件。 在其他的应用程序域中,这是由 ExecuteAssembly(String) 执行的第一个可执行文件。

public:
 static System::Reflection::Assembly ^ GetEntryAssembly();
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) 执行的第一个可执行文件。 当从非托管代码调用时可返回 null

注解

GetEntryAssembly 从非托管应用程序加载托管程序集时, null 方法可以返回 。 例如,如果非托管应用程序创建用 C# 编写的 COM 组件的实例,则从 C# 组件调用 方法将返回 null,因为进程的入口点是非托管代码,而不是 GetEntryAssembly 托管程序集。

适用于