Parameterized Methods

Learn to execute parameterized methods on threads.

The ParameterizedThreadStart delegate

Running a parameterless method on a thread is achieved by passing an instance of the ThreadStart delegate to a Thread constructor. What if we need to pass some parameters to the thread? The ParameterizedThreadStart delegate is used for this purpose:

public Thread(ParameterizedThreadStart start)

The ParameterizedThreadStart delegate has the following definition:

public delegate void ParameterizedThreadStart(object obj);

Using this delegate is no different than creating a thread with ThreadStart. Here’s an example:

Get hands-on with 1200+ tech skills courses.