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

Amar Resic
Amar Resic
2,922 Points

Coding Challenge help, In VideoGame.cs add a read only property named DisplayText of type string

Not sure why this is wrong, looks just like example from video. When I add readonly after public and before string it gives me a syntax error and it also throws the error "are using the Title followed by publisher in parenthesis Ex. Super Mario 64(Nintendo)." What went wrong?

VideoGame.cs
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; }

    public string DisplayText
        {
            get
            {
                return Title + "(" + Publisher + ")";
            }
        }
    }
}

1 Answer

Steven Parker
Steven Parker
229,744 Points

You're very close! All you need is to add a space between the Title and the open parenthesis to make the returned value conform to the example.