Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
In this video, we'll introduce our first challenge—adding a method to a class in order to define the first behavior for our Media Library program media types.
Prerequisites
This practice session assumes that you've completed stage 2 of the C# Objects course. If you haven't done that yet, go check it out, then come back to this workshop.
This practice session also builds upon the skills that are covered in the Practice Creating Classes in C# practice session that covers stage 1 of the C# Objects course. If you haven't completed this practice session yet, you might consider doing that first before attempting this practice session.
Instructions
1st Challenge
- Add a
GetDisplayText()
method to your selected media type class. This method should return a string containing the display text for the media type item.- Example: The
GetDisplayText()
method for an Album class would return the text "Album: Yellow Submarine by The Beatles" if theTitle
field was set to "Yellow Submarine" and theArtist
field was set to "The Beatles".
- Example: The
Help
If you get stuck on any of the following topics or simply need a refresher, click on a topic in list below to view the associated video in the C# Objects course.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up