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 trialRobert Rydlewski
3,828 PointsI need help. Fallowing the code and is the same as in the corse, but when I run me it has an error with doesn't make sen
```using System;
using System.Threading;
class Program
{
static void Ask (string question)
{
Console.WriteLine(question);
string answer = Console.ReadLine();
Console.WriteLine(answer);
}
static void Main(string[] args)
{
Console.WriteLine("Welcome to the cat food store!");
Ask.WriteLine("How many cans are you ordering? ");
}
}
As you see my code is the same however when I run my, I get error Program.cs(14,9): error CS0119: 'Program.Ask(string)' is a method, which is not valid in the given context. Please help as I don't get it how come to the code form video works but my don't ?? Any idea ??
2 Answers
KRIS NIKOLAISEN
54,971 PointsThe video has:
Ask("How many cans are you ordering?");
Your code has
Ask.WriteLine("How many cans are you ordering? ");
Robert Rydlewski
3,828 PointsSilly of me. Thank you 🙏 😊. I was losing my mind. Thank you again :)