Ejemplo n.º 1
0
 private static void CarregarContas2()
 {
     using (LeitorDeArquivo leitor = new LeitorDeArquivo("contas.txt"))
     {
         leitor.LerProximaLinha();
     }
 }
Ejemplo n.º 2
0
        private static void CarregarContas()
        {
            LeitorDeArquivo leitor = new LeitorDeArquivo("contas.txt");

            try
            {
                leitor.LerProximaLinha();
                leitor.LerProximaLinha();
                leitor.LerProximaLinha();
            }
            catch (IOException)
            {
                Console.WriteLine("Exceção do tipo IOException capturada e tratada!");
            }
            finally
            {
                if (leitor != null)
                {
                    leitor.Fechar();
                }
            }
        }