Skip to content

Instantly share code, notes, and snippets.

@paulodiogo
Last active August 29, 2015 13:56

Revisions

  1. paulodiogo renamed this gist May 19, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. paulodiogo created this gist Feb 21, 2014.
    25 changes: 25 additions & 0 deletions LendoArquivosUsandoReadAllLines.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System;

    class Program
    {
    static void Main()
    {
    // Write a string array to a file.
    string[] stringArray = new string[]
    {
    "cat",
    "dog",
    "arrow"
    };
    File.WriteAllLines("file.txt", stringArray);

    List<string> fileLines = File.ReadAllLines("file.txt").ToList();

    foreach(String s in fileLines)
    Console.WriteLine(s);

    }
    }