Sign In | Subscribe
Start learning today, and be successful in your academic & professional career. Start Today!
Loading video...
This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of C#
  • Discussion

  • Study Guides

  • Table of Contents

Bookmark and Share

Start Learning Now

Our free lessons will get you started (Adobe Flash® required).
Get immediate access to our entire library.

Sign up for Educator.com

Membership Overview

  • Unlimited access to our entire library of courses.
  • Search and jump to exactly what you want to learn.
  • *Ask questions and get answers from the community and our teachers!
  • Practice questions with step-by-step solutions.
  • Download lesson files for programming and software training practice.
  • Track your course viewing progress.
  • Download lecture slides for taking notes.
  • Learn at your own pace... anytime, anywhere!

Reading & Writing Files

  • Being able to save values between executions of your programs is key to creating useful, reusable programs
  • StreamWriter and StreamReader allow text to be read or written a little at a time, instead of all at once
  • Remember to .Flush and .Close your files!
  • Path.Combine is the safest way to create file path strings
  • .GetFiles and .GetFolders allow you to simply access file and folder names
  • FileInfo exposes information about a file, such as:
    • Extension
    • FullName
    • Length
    • CreationTime and LastAccessTime
  • .CopyTo copies a file from one place to another
  • If you want to move a file, use .CopyTo to copy it first, then use .Delete to delete the original
  • .GetTempFileName allows you to use temporary files without having to worry about cleaning up after they are no longer needed