Articles → CSHARP → Async And Await In C#
Async And Await In C#
Purpose
Example
class Program
{
static void Main(string[] args)
{
Program.CallAsyncMethod();
Console.ReadLine();
}
public static async void CallAsyncMethod()
{
await Task.Run(() =>
{
Console.WriteLine("Async method");
// Write the time consuming logic here.
});
}
}
Output
Click to Enlarge