C# C# Streams and Data Processing Streaming Data on the Net Become Zen

C# zenResponse Challenge Task 2

Please help. This is what it gives me: Bummer: Did you assign the return value of the 'DownloadString' method to the 'zenResponse' variable?

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

namespace Treehouse.CodeChallenges 
{ 
    class Program 
{ 
    static void Main(string[] args) 
    { 
        Console.WriteLine(BecomeZen()); 
          } 
        public static string BecomeZen() 
        { 
            string zenResponse = "";

        using(var webClient = new WebClient())
        {
        webClient.Headers.Add("User-Agent", "CodeChallenge");
        string response = webClient.DownloadString("https://api.github.com/zen");
        }

        return zenResponse;
    }
}
}

2 Answers

Steven Parker
Steven Parker
203,984 Points

The instructions say "Assign the result to the zenResponse variable.", but this code is assigning it to a new variable named "response" instead.

Remember to mark the question solved if this addresses the issue. And happy holidays!   :christmas_tree:

Alright. Thanks.

Sure, I'll do so. Happy holidays to you too, Steven.