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 trial

C# C# Streams and Data Processing Streaming Data on the Net Searching for News Headlines

Why does she not Wrap the "var webClient = new WebClient();" in a using statement?

According to the code challenges the WebClient() method inherits form IDisposable, and it requires us to use a using statement.

2 Answers

Steven Parker
Steven Parker
231,268 Points

Calling Dispose() on a WebClient doesn't actually do anything useful. It implements IDisposable only because it inherits that interface from the base class (Component).

This probably should have been mentioned in the previous video about WebClient (but I don't think it was).