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

Aaron Llanes
Aaron Llanes
881 Points

What is wrong with my code

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 + ")" ;
        }
    }
}

}

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
155,229 Points

You're really close, you just need a space before the open parenthesis to separate it from the title:

                return Title + " (" +  Publisher + ")";
//                              ^
//                              note space