C# C# Streams and Data Processing Streaming Data on the Net WebClient

Ariel Rzeszowski
Ariel Rzeszowski
2,512 Points

Why I can't get next step ? Everything in my opinion is ok, but I get a bummer.

Program ask Did I assign a ReadToEnd method to a treehouse variable. I think it's right

Program.cs
using System;
using System.IO;
using System.Net;

namespace Treehouse.CodeChallenges
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(GetTreehouseHome());
        }

        public static string GetTreehouseHome()
        {
            string treehouse = "";

            using(var webClient = new WebClient())
            {
                byte[] treehouseBytes = webClient.DownloadData("https://www.teamtreehouse.com");

                using (MemoryStream stream = new MemoryStream(treehouseBytes))
                {
                    using (var streamReader = new StreamReader(stream))
                    {
                        treehouse = streamReader.ReadToEnd();
                    }
                }
            }

            return treehouse;
        }
    }
}

2 Answers

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 49,890 Points

In the instructions for task 3: Add another using statement around a new StreamReader object named reader.

Instead of var reader you have var streamReader. Even though that passed task 3 the variable name is what is causing task 4 to fail.

Ariel Rzeszowski
Ariel Rzeszowski
2,512 Points

OMG, I fell stupid, I see diffrents now. I don't know why i didn't see it earlier. Thank you for you respond ;)