Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Practice Properties in C#!
You have completed Practice Properties in C#!
In this video, we'll review the solution to the first challenge and introduce our second challenge—adding computed properties to our media type classes.
Instructions
2nd Challenge
-
In each media type subclass, replace the
GetDisplayText()
method with aDisplayText
computed property.- Use either the regular C# property syntax or the more concise expression-bodied property syntax.
In the MediaLibrary class, add a
NumberOfItems
computed property that returns an integer representing the number of items in the media library.-
Update the Program.cs file as needed.
- Also add code to the
Main()
method in order to test the new MediaLibraryNumberOfItems
computed property.
- Also add code to the
Expression-Bodied Members
If you need a refresher on expression-bodied members in C#, checkout the following documentation.
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