Mega Code Archive

 
Categories / C# Tutorial / File Directory Stream
 

Simple IO with the File Type

using System; using System.IO; class Program {   static void Main(string[] args)   {     string[] myTasks = {"A", "C","C", "P"};     File.WriteAllLines(@"C:\tasks.txt", myTasks);     foreach (string task in File.ReadAllLines(@"C:\tasks.txt"))     {       Console.WriteLine("TODO: {0}", task);     }   } }