AssemblyBuilder.SetEntryPoint Method (MethodInfo, PEFileKinds)

 

Sets the entry point for this assembly and defines the type of the portable executable (PE file) being built.

Namespace:   System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

public void SetEntryPoint(
	MethodInfo entryMethod,
	PEFileKinds fileKind
)

Parameters

entryMethod
Type: System.Reflection.MethodInfo

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

fileKind
Type: System.Reflection.Emit.PEFileKinds

The type of the assembly executable being built.

Exception Condition
ArgumentNullException

entryMethod is null.

InvalidOperationException

entryMethod is not contained within this assembly.

SecurityException

The caller does not have the required permission.

System_CAPS_noteNote

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.

ReflectionPermission

when invoked late-bound through mechanisms such as Type.InvokeMember. Associated enumeration: ReflectionPermissionFlag.MemberAccess.

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Return to top
Show: