Task.Run Method (Action)
Queues the specified work to run on the ThreadPool and returns a task handle for that work.
Assemblies: System.Threading.Tasks (in System.Threading.Tasks.dll)
mscorlib (in mscorlib.dll)
The action parameter was a null reference (Nothing in Visual Basic).
The following example illustrates the method. It defines an array of directory names and starts a separate task to retrieve the file names in each directory. All tasks write the file names to a single ConcurrentBag(T) object. The example then calls the WaitAll(Task) method to ensure that all tasks have completed, and then displays a count of the total number of file names written to the ConcurrentBag(T) object.
Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)