using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AsyncAwatiConsole { class Program { static void Main(string[] args) { Example(); string result = Console.ReadLine(); Console.WriteLine("You typed: " + result); } public static async void Example() { int t = await Task.Run(() => Allocate()); } public static void Example2() { Task<int> task = new Task<int>(() => { return 11; }); task.Start(); task.Wait(); } static int Allocate() { // Compute total count of digits in strings. int size = 0; for (int z = 0; z < 100; z++) { for (int i = 0; i < 1000000; i++) { string value = i.ToString(); if (value == null) { return 0; } size += value.Length; } } return size; } } }