System.Threading.ParameterizedThreadStart Delegate

Represents the method that executes on a System.Threading.Thread.

Syntax

[System.Runtime.InteropServices.ComVisible(false)]
public delegate void ParameterizedThreadStart (object obj)

Parameters

obj
Documentation for this section has not yet been entered.

Remarks

When a managed thread is created, the method that executes on the thread is represented by a System.Threading.ThreadStart delegate or a System.Threading.ParameterizedThreadStart delegate that is passed to the erload:System.Threading.Thread.#ctor constructor. The thread does not begin executing until the erload:System.Threading.Thread.Start method is called. The System.Threading.ThreadStart or System.Threading.ParameterizedThreadStart delegate is invoked on the thread, and execution begins at the first line of the method represented by the delegate. In the case of the System.Threading.ParameterizedThreadStart delegate, the object that is passed to the Thread.Start(object) method is passed to the delegate.

Note:

Visual Basic and C# users can omit the System.Threading.ThreadStart or System.Threading.ParameterizedThreadStart delegate constructor when creating a thread. In Visual Basic, use the AddressOf operator when passing your method to the erload:System.Threading.Thread.#ctor constructor; for example, Dim t As New Thread(AddressOf ThreadProc). In C#, simply specify the name of the thread procedure. The compiler selects the correct delegate constructor.

Note:

When you create a System.Threading.ParameterizedThreadStart delegate for an instance method in C++, the first parameter of the constructor is the instance variable. For a static method, the first parameter of the constructor is zero. For a static method, the delegate constructor requires only one parameter: the address of the callback method, qualified by the class name.

The System.Threading.ParameterizedThreadStart delegate and the Thread.Start(object) method overload make it easy to pass data to a thread procedure, but this technique is not type safe because any object can be passed to Thread.Start(object). A more robust way to pass data to a thread procedure is to put both the thread procedure and the data fields into a worker object. For more information, see Creating Threads.

Requirements

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0