Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSharon Gracious Thato Khumomotse
2,380 PointsC# 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?
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
231,269 PointsThe instructions say "Assign the result to the zenResponse variable.", but this code is assigning it to a new variable named "response" (which is then never used).
And happy holidays!
Sharon Gracious Thato Khumomotse
2,380 PointsSure, I'll do so. Happy holidays to you too, Steven.
Sharon Gracious Thato Khumomotse
2,380 PointsSharon Gracious Thato Khumomotse
2,380 PointsAlright. Thanks.