Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# C# Basics (Retired) Console I/O Formatting Output

Knud Back
Knud Back
1,248 Points

Why do I get an error when I write "using System;" as the first part of my code?

The Quiz as me to use "Console.ReadLine();" and not "System.Console.ReadLine();". In that case I would expect that defining the namespace "System" would be requeried. But the quiz will not accept my answer when start the code by writing "using System;".

1 Answer

Simon Coates
Simon Coates
28,693 Points

It may be inserting your code into a main method behind the scenes. That main method may reside in a class that already includes the line that provides you access to System.Console. A lot of the quizzes ask you for loose code, rather than making you write the complete code structure (eg. class, namespace etc), and it can make things confusing.