C# ASP.NET MVC Basics Modeling and Presenting Data Creating a Data Model

Where have I gone wrong? (Bummer! Did you declare a property named 'Id' in VideoGame?)

I've created the requested properties within the VideoGame class, but on submission I'm given the message above. Any help would be appreciated, thanks.

VideoGame.cs
namespace Treehouse.Models
{
    public class VideoGame
    {
        public int Id;
        public string Title;
        public string Description;
        public string[] Characters;
        public string Publisher;
    }
}

1 Answer

Steven Parker
Steven Parker
168,625 Points

You've declared a collection of public fields with various names and types, but the instructions asked for properties.

For example, the declaration of " a property named Id of type int" might look like this:

        public int Id {get; set;}

Ah, that was it. Thanks! I didn't really understand that distinction before.