I'd like to have a method where I can pass another method (without any parameters).
In that method, there would be a thread to call the passed method.
Not really sure how to implement this but the whole idea is something like this:
private static void Main(string[] args)
{
MethodStarter(Greet)
}
void MethodStarter(Method method)
{
ThreadStart starter = method;
_thread = new Thread(starter) { IsBackground = true };
_thread.Start();
}
void Greet()
{
ThreadPool.QueueUserWorkItem(new WaitCallback(SendAMessage), "Hello World");
Thread.Sleep(5000);
ThreadPool.QueueUserWorkItem(new WaitCallback(SendAMessage), "How are you today?");
Thread.Sleep(5000);
}
void SendAMessage(object arg)
{
Console.WriteLine(arg as string);
}