If you want a threadpool thread you could do this:
private delegate void MyDelegate(string text);
private void button6_Click(object sender, System.EventArgs e)
{
// Fire a simple method on the thread pool with no args and void return
using a system defined delegate.
new System.Windows.Forms.MethodInvoker(DoThis).BeginIn voke(null, null);
// Fire a custom delegate on the thread pool with user defined delegate.
new MyDelegate(DoThat).BeginInvoke("Delegates are fun.", null, null);
}
private void DoThis()
{
Console.WriteLine("Did this.");
Console.WriteLine("Is Thread Pool?:" +
Thread.CurrentThread.IsThreadPoolThread);
}
private void DoThat(string text)
{
// Also call EndInvoke.
Console.WriteLine("Did that:"+text);
Console.WriteLine("Is Thread Pool?:" +
Thread.CurrentThread.IsThreadPoolThread);
}
--
William Stacey, MVP
"Fernando Rodríguez" <fe*******************@fernando-rodriguez.com> wrote in
message news:3o********************************@4ax.com...
Hi,
ThreadStart doesn't take any parameters. How can I create threads that
take parameters? O:-)
Thanks