C# 14 · Async, errors and resources

Read and write files

Read and write text asynchronously.

var text = await File.ReadAllTextAsync("data.txt");
await File.WriteAllTextAsync("copy.txt", text);

Official C# 14 documentation

More async, errors and resources commands

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

Was this page helpful?