How to return value from a thread
-
Hi, there are many ways you can pass data to a thread, and retrieve results. For one, there is a possibility to pass an object to Thread.Start(); so you could store all the inputs in that object before you start the thread, and/or retrieve all the results once the thread is done. Or you could turn that around, and have a little class (say class Job), which you instantiate, pass parameters (thru properties maybe), then call its Run method (which launches a thread inside that class, invisible to the outside world), and finally gets the results available somehow (e.g. again as Properties). This is my preferred way; it makes it very easy to run several similar jobs at the same time, just by instatiating more Job objects and Run()ning them. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Fixturized forever. :confused: