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#

Help, I'm getting an error!

Hello, I currently watching videos for the C# Basics. I was following everything that the instructor was telling me and I got this error.

(Error CS0117 'string' does not contain a definition for 'entry')

Here is my code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LearningCode
{
    class Program
    {
        static void Main(string[] args)
        {
            // Prompt the user for minutes exercised
            System.Console.Write("Enter how many minutes you have exercised: ");


            string.entry = System.Console.ReadLine();

            //Add minutes exercided to total
            //Display total minutes exercised to the screen
            //Repeat until user leaves the app
        }
    }
}
Michael Milone
Michael Milone
1,474 Points
string entry = System.Console.ReadLine();

Thanks ^^

1 Answer

Steven Parker
Steven Parker
231,248 Points

I assume you're intending to create a variable named "entry" that is of type "string". In that case you would separate the type and the name with a space instead of a period.