AssemblyBuilder.SetEntryPoint Method

Definition

Sets the entry point for this dynamic assembly.

Overloads

SetEntryPoint(MethodInfo)

Sets the entry point for this dynamic assembly, assuming that a console application is being built.

SetEntryPoint(MethodInfo, PEFileKinds)

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)

Parameters

entryMethod
MethodInfo

A reference to the method that represents the entry point for this dynamic assembly.

Exceptions

entryMethod is null.

entryMethod is not contained within this assembly.

The caller does not have the required permission.

Security

ReflectionPermission
when invoked late-bound through mechanisms such as InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]). Associated enumeration: MemberAccess.

SetEntryPoint(MethodInfo, PEFileKinds)

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)

Parameters

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.

Exceptions

entryMethod is null.

entryMethod is not contained within this assembly.

The caller does not have the required permission.

Remarks

Note

Starting with the .NET Framework 2.0 Service Pack 1, this member no longer requires ReflectionPermission with the ReflectionPermissionFlag.ReflectionEmit flag. (See Security Issues in Reflection Emit.) To use this functionality, your application should target the .NET Framework 3.5 or later.

Security

ReflectionPermission
when invoked late-bound through mechanisms such as InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]). Associated enumeration: MemberAccess.

Applies to