Advertisement
vlad0

Text Files 01

Jan 23rd, 2013
498
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6.  
  7. namespace _01.PrintOddLines
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             using (StreamReader sw = new StreamReader("../../mytemp.txt")) //the dir of the .cs file
  14.             {
  15.                 int lineNumber = 1;
  16.                 string line = sw.ReadLine();
  17.                 while (line!=null)
  18.                 {
  19.                     if (lineNumber%2 != 0)
  20.                     {
  21.                         Console.WriteLine(line);
  22.                     }
  23.                     lineNumber++;
  24.                     line = sw.ReadLine();
  25.                 }
  26.             }
  27.  
  28.            
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement