CSharp examples for Thread Asynchronous:Task
Create new Task
using System;/* w w w. j ava 2 s. com*/ using System.Threading; using System.Threading.Tasks; using System.Diagnostics; using static System.Console; class Program { static void Main(string[] args) { var outer = Task.Factory.StartNew(() => { WriteLine("Outer task starting..."); var inner = Task.Factory.StartNew(() => { WriteLine("Inner task starting..."); Thread.Sleep(2000); WriteLine("Inner task finished."); }, TaskCreationOptions.AttachedToParent); }); outer.Wait(); } }