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# ASP.NET MVC Basics Modeling and Presenting Data Creating a Data Model

Can Anybody tell me what I am doing wrong here?

I am pretty sure I have done what the challenge has asked, at least the first part, but it keeps telling me I am missing some structs?

Here is my code: using System; using System.Collections.Generic; using System.Linq; using System.Web;

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

VideoGame.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;





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

1 Answer

Dane Parchment
MOD
Dane Parchment
Treehouse Moderator 11,075 Points

Recall your variable typesetting skills, when you create a new variable with an array type, how do you call it?

Like so: type [] variableName.

Look carefully at your code, where do you create you array type, and do you notice anything wrong with it?


If you cannot figure it out, then your solution is:

changing public string Characters[] {get; set;} to public string [] Characters {get; set;}