static void Main(string[] args) { string test = string.Empty; StreamReader SR = new StreamReader("test.txt"); StreamWriter SW = new StreamWriter("out.txt"); Chanel chan = new Chanel(); while ((test = SR.ReadLine()) != null) { if (test == "4" || test == "8") chan.Print(SR); } SR.Close(); Console.ReadKey(); }