Searching...
Wednesday, 12 November 2008

Passing Data to Thread in .Net

In most real world use of threading, you will need to pass information to individual threads. To do this you will need to use a new delegate called ParameterizedThreadStart. It specifies a method signature with a single parameter of type object and returns nothing.

Single Parameter – ParameterizedThreadStart specifies a method signature with a single parameter of type object and returns nothing.



Multiple Parameters – As ParameterizedThreadStart accept only single parameter of type Object. In case if you need to pass multiple parameters to the thread method then you can do it by passing an array object to the ParameterizedThreadStart delegate. Array object can be of same type or multiple types.


Return Values – ParameterizedThreadStart delegate returns nothing. But you can get return values from thread method through object properties, delegate calls or anonymous methods.


0 comments:

Post a Comment