0.4.17 Reading Information From a Text File

Reading Brings Persistent Information Back Into the Program

Writing moves information from the running application into a file.

Reading moves information in the opposite direction.

Suppose lineup.txt already contains:

Activity diagram showing text file, then File.ReadAllText(...), then string in memory.
TextFile.
  • New
  • Changed
  • Removed
Write and Read Form a Persistence Cycle

The two basic operations now connect.

Save
memory → WriteAllText → file
Load
file → ReadAllText → memory

The C# methods are small.

The conceptual shift is larger.

You can now distinguish information that exists only during the current execution from information that has been persisted and recovered later.