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# Basics (Retired) Console I/O Formatting Output

Kanwaldeep Sekhon
PLUS
Kanwaldeep Sekhon
Courses Plus Student 1,298 Points

Setting a parameter in C sharp

How do you set a parameter in C sharp?

CodeChallenge.cs
string firstName = Console.ReadLine();
Console.WriteLine = "firstName";

1 Answer

andren
andren
28,558 Points

You pass a parameter by putting it inside the parentheses when calling a method, like this:

  Console.WriteLine(PARAMETER);

You can supply multiple parameters by separating them with commas:

  Console.WriteLine(PARAMETER1, PARAMETER2, PARAMETER3);

It should also be noted that when you are referencing a variable you do not put it in quotes like you are doing in your code, quotes are only used for strings.

So to sum things up, to fix your code you have to drop the = sign and the quotes around "firstName". Then move firstName within the parenthesis of the Console.WriteLine method.