C# 14 · Async, errors and resources

Write an async method

Await I/O without blocking a thread. Async methods return Task or Task<T>.

async Task<string> GetAsync(HttpClient http, string url)
{
    return await http.GetStringAsync(url);
}

Official C# 14 documentation

More async, errors and resources commands

All async, errors and resources commands · C# 14 cheatsheet

Was this page helpful?