Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Challenge: Asynchronously Reading Files | Section
Introduction to .NET with C#

bookChallenge: Asynchronously Reading Files

メニューを表示するにはスワイプしてください

In the previous section, we learned about a file reading method called File.ReadAllText. While it is a synchronous method for reading a file, there is an asynchronous alternative as well - It is called File.ReadAllTextAsync.

There is an attached file in the task description. This is the file we want to read. The base code contains a program that reads the file synchronously.

Task:

Currently, the output of the program is:

Started Program
Started Reading File
Ended Reading File
<< ASYNC CHECK >>
Ended Program

Notice how <<ASYNC CHECK>> is only printed after the file is fully read. We want it to print while the file is being read.

Your task is to modify the code and make the program asynchronously read the file.

If the << ASYNC CHECK >> message prints between Started Reading File and Ended Reading File messages, then it means you have successfully implemented an asynchronous solution:

Started Program
Started Reading File
<< ASYNC CHECK >>
Ended Reading File
Ended Program

すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 1.  12

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

セクション 1.  12
some-alt