Interview Question

What is async/await?

await asynchronously waits for an operation; it does not inherently create a thread.

💡 Concept ✅ Quick Revision 🔷 C#

Answer

async and await provide language support for composing asynchronous operations without blocking during an incomplete await. • An async method commonly returns Task, Task<T>, ValueTask, or ValueTask<T>. • await pauses the method and schedules its continuation when the awaitable completes. • async does not automatically create a new thread.

💡 C# Example

static async Task<string> LoadAsync(HttpClient client) { return await client.GetStringAsync("https://example.com"); }

⚡ Quick Revision

await asynchronously waits for an operation; it does not inherently create a thread.