Thread Constructor (ParameterizedThreadStart)
Collapse the table of content
Expand the table of content

Thread Constructor (ParameterizedThreadStart)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Initializes a new instance of the Thread class, specifying a delegate that allows an object to be passed to the thread when the thread is started.

Namespace:  System.Threading
Assembly:  mscorlib (in mscorlib.dll)

public Thread(
	ParameterizedThreadStart start


Type: System.Threading.ParameterizedThreadStart
A delegate that represents the methods to be invoked when this thread begins executing.


start is null.

A thread does not begin executing when it is created. To schedule the thread for execution, call the Start method. To pass a data object to the thread, use the Start(Object) method overload.


Visual Basic and C# users can omit the ThreadStart or ParameterizedThreadStart constructor when creating a thread. The compilers automatically call the appropriate constructor. For Visual Basic, use the AddressOf operator when passing your method; for example, Dim t As New Thread(AddressOf ThreadProc).

The following example shows how to create and start a thread by using a ParameterizedThreadStart delegate with a static method.

The example displays its output in a TextBlock on the user interface (UI) thread. To access the TextBlock from the callback thread, the example uses the Dispatcher property to obtain a Dispatcher object for the TextBlock, and then uses the Dispatcher.BeginInvoke method to make the cross-thread call.

For more information about thread creation, see Creating Threads and Passing Data at Start Time. For example code that uses this constructor and passes thread synchronization objects to thread procedures, see EventWaitHandle.

using System;
using System.Threading;

public class Example
   private static System.Windows.Controls.TextBlock outputBlock;

   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
      Example.outputBlock = outputBlock;

      // To start a thread using a shared thread procedure, use
      // the class name and method name when you create the 
      // ParameterizedThreadStart delegate. C# infers the 
      // appropriate delegate creation syntax:
      //    New ParameterizedThreadStart(Example.DoWork)
      Thread newThread = new Thread(Example.DoWork);

   // Simulate work. To communicate with objects on the UI thread, get the 
   // Dispatcher for one of the UI objects. Use the Dispatcher object's 
   // BeginInvoke method to queue a delegate that will run on the UI thread,
   // and therefore can safely access UI elements like the TextBlock.
   private static void DoWork(object state)
      int data = (int) state;

      outputBlock.Dispatcher.BeginInvoke(delegate () { 
         outputBlock.Text += String.Format("Static thread procedure. Data={0}\n", data); 

/* This code example produces the following output:

Static thread procedure. Data=42

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2017 Microsoft