The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
Thread::CurrentThread Property
.NET Framework (current version)
Gets the currently running thread.
Assembly: mscorlib (in mscorlib.dll)
The following example creates a task that in turn creates 20 child tasks. The application itself, as well as each task, calls the ShowThreadInformation method, which uses the CurrentThread property to display information about the thread on which it is running.
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Show:
Each child task generates 1 million random numbers between 1 and 1 million and returns their mean. The parent task calls the Task::WaitAll method to ensure that the child tasks have completed before displaying the mean returned by each task and calculating the mean of means.
Note that while the application runs on a foreground thread, each task runs on a thread pool thread.