Assembly.GetEntryAssembly Assembly.GetEntryAssembly Assembly.GetEntryAssembly Assembly.GetEntryAssembly Method

定义

获取默认应用程序域中的进程可执行文件。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

返回

程序集是默认应用程序域中的进程可执行文件,或是由 ExecuteAssembly(String) 执行的第一个可执行文件。The assembly that is the process executable in the default application domain, or the first executable that was executed by ExecuteAssembly(String). 当从非托管代码调用时可返回 nullCan return null when called from unmanaged code.

注解

GetEntryAssembly托管程序集null已从非托管应用程序加载时,该方法可以返回。The GetEntryAssembly method can return null when a managed assembly has been loaded from an unmanaged application. 例如,如果非托管应用程序创建用编写的 COM 组件的实例C#,则从GetEntryAssembly C#组件对方法的调用将返回 null,因为进程的入口点是非托管代码而不是托管代码件.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.

适用于