class ThreadController
{
private int i;
private string s;
public ThreadController(int i, string s)
{
this.s = s;
this.i = i;
}
public void ThreadProc()
{
// use i and s
}
}
ThreadController tc = new ThreadController(42, "Hello World");
Thread t = new Thread(new ThreadStart(tc.ThreadProc);
t.Start();
Regards
Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog http://www.dotnetconsult.co.uk
nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<41********@news.starhub.net.sg>
How to pass a data to a newly created thread in the following?
--------------------------------------------------------------------
Thread newthread = new Thread (new ThreadStart (Method));
newthread.Start ();
void Method (){
.... some code. ...
}
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.782 / Virus Database: 528 - Release Date: 22/10/2004
[microsoft.public.dotnet.languages.csharp]