Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
- namespace lolz
- {
- class Program
- {
- static void Main(string[] args)
- {
- const string f = "hemmelig.txt";
- // 1
- // Declare new List.
- List<string> lines = new List<string>();
- // 2
- // Use using StreamReader for disposing.
- using (StreamReader r = new StreamReader(f))
- {
- // 3
- // Use while != null pattern for loop
- string line;
- while ((line = r.ReadLine()) != null)
- {
- // 4
- // Insert logic here.
- // ...
- // "line" is a line in the file. Add it to our List.
- lines.Add(line);
- }
- }
- // 5
- // Print out all the lines.
- foreach (string s in lines)
- {
- }
- Console.ReadKey();
- }
- }
- }
Add Comment
Please, Sign In to add comment