Jeff and .NET

The .NET musings of Jeff Putz

Sponsors

News

My Sites

ParameterizedThreadStart: Good call!

I just noticed that a new overload of the Thread constructor was added to .NET v2, accepting a ParameterizedThreadStart object. Cleverly enough, it allows you to call the thread's Start() method with a parameter to pass in to the method you're firing in its own thread. I don't understand why that wasn't there from the start, but good call!

Posted: Aug 25 2004, 02:25 AM by Jeff | with 2 comment(s)
Filed under:

Comments

Assur said:

You can only pass one parameter and your function must accept "object" for type. Next to that, to pass more parameters you have to use the delegate workaround. But it's a good start anyhow, it's better than nothing.

# February 7, 2007 2:37 PM

Corvidae said:

Public Class Parameters

 Public strParam as String

 Public intParam as Integer

 ... etc etc

Then just pass in a copy of the parameters class.  A few delegates and it makes a decent traffic conductor for pulling data in and out of threads too.  It's way too bulky for fine grain threading, but works decently for long running stuff.

# April 4, 2008 2:36 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)