private static void CarregarContas() { using (LeitorDeArquivos leitor = new LeitorDeArquivos("teste.txt")) { leitor.LerProximaLinha(); } // ---------------------------------- //LeitorDeArquivos leitor = null; //try //{ // leitor = new LeitorDeArquivos("contas.txt"); // leitor.LerProximaLinha(); // leitor.LerProximaLinha(); // leitor.LerProximaLinha(); //} //catch(IOException) //{ // Console.WriteLine("Exceção do tipo IOException capturada e tratada!"); //} //finally //{ // if(leitor != null) // { // leitor.Fechar(); // } //} }
public static void CarregarContas() { using (LeitorDeArquivos leitor = new LeitorDeArquivos("teste.txt")) { leitor.LerProximaLinha(); } //LeitorDeArquivos leitor = null; //try //{ // leitor = new LeitorDeArquivos("contas.txt"); // leitor.LerProximaLinha(); // leitor.LerProximaLinha(); // leitor.LerProximaLinha(); //} //finally //{ // if(leitor != null) // { // leitor.Fechar(); // } //} }