Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (19 sloc) 1.04 KB
title ms.date ms.technology dev_langs helpviewer_keywords ms.assetid
How to: Traverse a Binary Tree with Parallel Tasks
03/30/2017
dotnet-standard
csharp
vb
tasks, how to traverse a tree
4265d169-6c69-4f36-b10d-b7ae7f72f4df

How to: Traverse a Binary Tree with Parallel Tasks

The following example shows two ways in which parallel tasks can be used to traverse a tree data structure. The creation of the tree itself is left as an exercise.

Example

[!code-csharpTPL#16] [!code-vbTPL#16]

The two methods shown are functionally equivalent. By using the xref:System.Threading.Tasks.TaskFactory.StartNew%2A method to create and run the tasks, you get a handle back from the tasks which can be used to wait on the tasks and handle exceptions.

See also

You can’t perform that action at this time.