G
Guest
I have found this code snippet in the MSDN Library
[C#]
using System
using System.Threading
class Tes
static void Main()
ThreadStart threadDelegate = new ThreadStart(Work.DoWork)
Thread newThread = new Thread(threadDelegate)
newThread.Start()
class Work
public static void DoWork() {
I would like to create an assembly by Reflection.Emit that contains that lines
How do I create the line 'ThreadStart threadDelegate = new ThreadStart(Work.DoWork);'
I dont know the number and kind of types (see 'zParameters') that are required to cal
the function 'zILGenerator.Emit(..)'. Here is the a part of the code I am referring to
MethodBuilder zMethodBuilder = ..
ILGenerator zILGenerator = zMethodBuilder.GetILGenerator()
Type[] zParameters = new Type[???]
zParameters[0] = ???
zParameters[1] = ???
// etc
zILGenerator.Emit(OpCodes.Newobj, typeof(System.Threading.ThreadStart).GetConstructor(zParameters))
[C#]
using System
using System.Threading
class Tes
static void Main()
ThreadStart threadDelegate = new ThreadStart(Work.DoWork)
Thread newThread = new Thread(threadDelegate)
newThread.Start()
class Work
public static void DoWork() {
I would like to create an assembly by Reflection.Emit that contains that lines
How do I create the line 'ThreadStart threadDelegate = new ThreadStart(Work.DoWork);'
I dont know the number and kind of types (see 'zParameters') that are required to cal
the function 'zILGenerator.Emit(..)'. Here is the a part of the code I am referring to
MethodBuilder zMethodBuilder = ..
ILGenerator zILGenerator = zMethodBuilder.GetILGenerator()
Type[] zParameters = new Type[???]
zParameters[0] = ???
zParameters[1] = ???
// etc
zILGenerator.Emit(OpCodes.Newobj, typeof(System.Threading.ThreadStart).GetConstructor(zParameters))