[nfbcs] Reading text files c# and exceptions

Mike Gorse mike at straddlethebox.org
Mon Dec 12 23:30:54 UTC 2016


Hi Taylor,

What exception are you getting? I just compiled your code (using mono, 
which may or may not make a difference) and got a couple of warnings about 
unused variables, but, anyhow, I created a test file and ran the compiled 
program, and it did what it is supposed to do (print a line of text, then 
ask for input).

-Mike

On Sun, 11 Dec 2016, Taylor Arndt via nfbcs wrote:

> Hi,
> So i am trying to read a file and i get a exception when  i am doing it
> using System;
> using System.IO;
>
> namespace text_file_reading_practice
> {
>    class Program
>    {
>        private static object file;
>        private static object reader;
>
>        static void Main(string[] args)
>        {
>
>            string line;
>            using (StreamReader reader = new
> StreamReader("TriviaGameQuestions.txt"))
>            {
>                line = reader.ReadLine();
>            }
>            Console.WriteLine(line);
>
>        Console.ReadLine();
>
>        }
>
>
>
>    }
> }
>
>
> -- 
> Taylor
>
> _______________________________________________
> nfbcs mailing list
> nfbcs at nfbnet.org
> http://nfbnet.org/mailman/listinfo/nfbcs_nfbnet.org
> To unsubscribe, change your list options or get your account info for nfbcs:
> http://nfbnet.org/mailman/options/nfbcs_nfbnet.org/mike%40straddlethebox.org
>




More information about the NFBCS mailing list