File.ReadAllLines : File « File Directory Stream « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

class MainClass
{
    static void Main(string[] args)
    {
        StreamWriter writer = new StreamWriter(@"c:\myfile.txt");
        for (int i = 0; i < 3; i++)
        {
            writer.Write(i.ToString());
        }
        writer.Flush();
        writer.Close();

        foreach (string line in File.ReadAllLines(@"c:\myfile.txt"))
        {
            Console.WriteLine(line);
        }
    }
}
012








15.1.File
15.1.1.Key Members of the System.IO Namespace
15.1.2.File: GetCreationTime and GetLastAccessTime
15.1.3.Create the FileInfo class from the file selected in the OpenFileDialog
15.1.4.File.Exists
15.1.5.File.ReadAllLines
15.1.6.File.WriteAllLines