AssemblyBuilder.SetEntryPoint 方法

定义

设置此动态程序集的入口点。Sets the entry point for this dynamic assembly.

重载

SetEntryPoint(MethodInfo)

为此动态程序集设置一个入口点,假设正构建一个控制台应用程序。Sets the entry point for this dynamic assembly, assuming that a console application is being built.

SetEntryPoint(MethodInfo, PEFileKinds)

设置此程序集的入口点并定义正在生成的可移植执行文件(PE 文件)的类型。Sets the entry point for this assembly and defines the type of the portable executable (PE file) being built.

SetEntryPoint(MethodInfo)

为此动态程序集设置一个入口点,假设正构建一个控制台应用程序。Sets the entry point for this dynamic assembly, assuming that a console application is being built.

public:
 void SetEntryPoint(System::Reflection::MethodInfo ^ entryMethod);
public void SetEntryPoint (System.Reflection.MethodInfo entryMethod);
member this.SetEntryPoint : System.Reflection.MethodInfo -> unit
Public Sub SetEntryPoint (entryMethod As MethodInfo)

参数

entryMethod
MethodInfo

对表示此动态程序集入口点的方法的引用。A reference to the method that represents the entry point for this dynamic assembly.

例外

entryMethodnullentryMethod is null.

entryMethod 不包含在此程序集内。entryMethod is not contained within this assembly.

调用方没有所要求的权限。The caller does not have the required permission.

适用于

SetEntryPoint(MethodInfo, PEFileKinds)

设置此程序集的入口点并定义正在生成的可移植执行文件(PE 文件)的类型。Sets the entry point for this assembly and defines the type of the portable executable (PE file) being built.

public:
 void SetEntryPoint(System::Reflection::MethodInfo ^ entryMethod, System::Reflection::Emit::PEFileKinds fileKind);
public void SetEntryPoint (System.Reflection.MethodInfo entryMethod, System.Reflection.Emit.PEFileKinds fileKind);
member this.SetEntryPoint : System.Reflection.MethodInfo * System.Reflection.Emit.PEFileKinds -> unit
Public Sub SetEntryPoint (entryMethod As MethodInfo, fileKind As PEFileKinds)

参数

entryMethod
MethodInfo

对表示此动态程序集入口点的方法的引用。A reference to the method that represents the entry point for this dynamic assembly.

fileKind
PEFileKinds

正在生成的程序集可执行文件的类型。The type of the assembly executable being built.

例外

entryMethodnullentryMethod is null.

entryMethod 不包含在此程序集内。entryMethod is not contained within this assembly.

调用方没有所要求的权限。The caller does not have the required permission.

注解

备注

从 .NET Framework 2.0 Service Pack 1 开始,此成员不再需要 ReflectionPermission 带有 ReflectionPermissionFlag.ReflectionEmit 标志的。Starting with the .NET Framework 2.0 Service Pack 1, this member no longer requires ReflectionPermission with the ReflectionPermissionFlag.ReflectionEmit flag. (参阅 反射发出中的安全问题。 ) 若要使用此功能,你的应用程序应面向 .NET Framework 3.5 或更高版本。(See Security Issues in Reflection Emit.) To use this functionality, your application should target the .NET Framework 3.5 or later.

适用于