The Following code does not display the resutl:
static void Main(string[] args)
{
Task<DayOfWeek> taskA = Task.Run(() => DateTime.Today.DayOfWeek);
Task continuation = taskA.ContinueWith(antecedent => Console.WriteLine("\n\nToday is {0}.", antecedent.Result));
}
This can be solved by:
try
{
taskA.Wait();
continuation.Wait();
}
catch (AggregateException ae)
{
foreach (var ex in ae.InnerExceptions)
Console.WriteLine(ex.Message);
}