Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Task - Asynchronously Reading Files | Asynchronous Programming and Introduction to Web Services
Introduction to .NET with C#
course content

Contenido del Curso

Introduction to .NET with C#

Introduction to .NET with C#

1. Introduction
2. Asynchronous Programming and Introduction to Web Services
3. Introduction to Databases with .NET
4. CRUD Operations with MySQL
5. Optimizing Database Operations

bookTask - 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:

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:

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 3
We're sorry to hear that something went wrong. What happened?
some-alt