1. Course
  2. Text Files A
  3. Read a text file with File

Read a text file with File


Last updated: 8/23/2020 Difficulty: Easy

Create a C# program that reads a text file and shows all its lines on the screen.

Use the File class to read the text file.

Input

Output

Lorem ipsum dolor sit amet consectetur adipiscing elit nulla commodo facilisis.
Est litora vitae imperdiet senectus sed purus lacus fermentum libero.
Odio faucibus nibh massa per euismod etiam netus nunc. Mus ad aliquam non 
fermentum eu libero eros nullam varius curabitur, ligula et sem sapien eget fringilla 
convallis nostra suscipit, metus egestas curae penatibus potenti fames urna 
vulputate himenaeos. Venenatis dapibus congue quis aptent tincidunt vivamus 
hendrerit litora purus, sollicitudin vestibulum malesuada fusce urna neque luctus integer.

Curabitur netus dictum in mollis bibendum auctor ante, molestie suspendisse habitant 
nostra tempor eu facilisi, nulla quam potenti integer aenean nisi. Litora vivamus hac 
euismod justo sociis malesuada aliquet leo pretium nullam ullamcorper vitae nostra mi 
dis facilisis vehicula, taciti molestie semper aliquam aptent fermentum maecenas eros tempor 
felis commodo blandit neque dui dapibus donec. Id erat curabitur sem dapibus eros bibendum, 
feugiat per phasellus enim class mauris auctor, tortor magnis nisi vivamus velit.

Solution

Text Files A

3 / 6

Android App


Practice C# anywhere with the free app for Android devices.

Android App

Exercises C# by difficulty


Learn C# at your own pace, the exercises are ordered by difficulty.

Advertising