none
c# reading from text file RRS feed

  • General discussion

  • Receive two error

    1. The type or namespace name 'async' could not be found (are you missing a using directive or an assembly reference?

    2.The name 'await' does not exist in the current context

    public async void Main()

        {
             try
                {
                    using (StreamReader sr = new StreamReader("c:\\TestFile.txt"))
                    {
                        String line = await sr.ReadToEndAsync();
                        ResultBlock.Text = line;
                    }
                }
                catch (Exception ex)
                {
                    ResultBlock.Text = "Could not read the file";
                }


        }


    Support@Mytechnet.me

    Friday, April 19, 2013 7:40 PM

All replies