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

Unable to return a property in parentheses

I have the following question: "In VideoGame.cs add a read only property named DisplayText of type string. For the property's return value, return the Title property value followed by the Publisher property value in parentheses (i.e. "Super Mario 64 (Nintendo)").". I have tried to place the 'Publisher' return value in parentheses using the " '" + Publisher + "'" but the code is not accepted. Please assist.

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

        }

}

2 Answers

Steven Parker
Steven Parker
231,269 Points

:point_right: It looks like you're using the wrong characters.

You're code is adding quotes (") around the Publisher, but it should be parentheses :point_right:():point_left:.

And you should use quotes instead of apostrophes ("single quotes") to make your additions strings instead of single characters. That will make it easy to include a space along with the open parenthesis (" (") to satisfy the challenge's format expectations.

Thanks for the answer but it didn't work. I did the following based on your answer and what the question is asking for:

return Title + (Publisher);

This still returns the same error. I cannot get passed this - it seems simple enough.

Ok... stupid problem resolved. PEBCAC error :)

Thanks for the help.

i am not passing the question. please help!!

I just figured it out. I had a stray curly brace in mine.

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