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 Serialization Deserializing with Json.NET

C# Serializing Coding Challenge - Issue with wrapping the StreamReader object in a 'using' statement.

using( var reader = new StreamReader(fileName) )

I'm not sure why the code for task 2 doesn't work. I've tried it with and without curly braces/brackets. I've tried instantiating the StreamReader object and THEN passing it to the using statment, even though that is not the recommended way. No matter what I do the response I get is, "Did you wrap your StreamReader object in a using statement?" The syntax here should be just like what we have done already. Maybe there is something obviously wrong with my code, but I'm just not realizing it.

1 Answer

Steven Parker
Steven Parker
231,275 Points

This would be no problem in actual code, but the challenge apparently doesn't like the space padding inside the parentheses of the using statement.

You may want to report this as a bug to Support.