1 00:00:00,000 --> 00:00:04,569 [MUSIC] 2 00:00:04,569 --> 00:00:06,454 Hi, everyone, this is James. 3 00:00:06,454 --> 00:00:10,440 In this C# practice session you'll practice creating and 4 00:00:10,440 --> 00:00:12,860 instantiating classes using C#. 5 00:00:12,860 --> 00:00:17,930 It reinforces what you learned in stage one of the C# objects course. 6 00:00:17,930 --> 00:00:21,050 If you find this practice session too challenging to complete, 7 00:00:21,050 --> 00:00:23,080 you might need to review that course. 8 00:00:23,080 --> 00:00:25,200 See the teachers notes for a link. 9 00:00:25,200 --> 00:00:28,640 This practice session is the first in a series of sessions 10 00:00:28,640 --> 00:00:31,905 where you'll build out a media library console application. 11 00:00:31,905 --> 00:00:35,720 Step-by-step, you'll add features to the program. 12 00:00:35,720 --> 00:00:40,280 Eventually, you'll be able to use C# to add, list, and 13 00:00:40,280 --> 00:00:43,070 search for items like albums, books, and 14 00:00:43,070 --> 00:00:47,240 movies, whatever you want to have catalogued in your media library. 15 00:00:47,240 --> 00:00:51,320 We'll start the development of our program by creating a C# class for 16 00:00:51,320 --> 00:00:56,570 each type of item, or media type, that can be added to your media library. 17 00:00:56,570 --> 00:00:57,630 For example, for 18 00:00:57,630 --> 00:01:02,890 my media library program I'm going to support albums, books, and movies. 19 00:01:02,890 --> 00:01:07,020 You can use the same media types or you can come up with your own types. 20 00:01:07,020 --> 00:01:11,110 Remember that objects have both attributes and behaviors. 21 00:01:11,110 --> 00:01:15,010 In this session we'll think about the attributes that we want to track for 22 00:01:15,010 --> 00:01:17,510 each of the media types, and add a field for 23 00:01:17,510 --> 00:01:23,230 each attribute to the appropriate media type class in future practice sessions. 24 00:01:23,230 --> 00:01:27,780 We'll add behaviors to our media types by extending our media type classes with 25 00:01:27,780 --> 00:01:28,940 methods. 26 00:01:28,940 --> 00:01:31,120 I've attached a workspace to this video. 27 00:01:31,120 --> 00:01:35,260 Go ahead and open the workspace or download the project files 28 00:01:35,260 --> 00:01:40,100 if you want to use an external editor or IDE like VisualStudio. 29 00:01:40,100 --> 00:01:44,040 For your first challenge, you'll add at least two classes to the program, 30 00:01:44,040 --> 00:01:49,540 one class for each type of item, or media type, that can be added to your library. 31 00:01:49,540 --> 00:01:54,800 Define each class, using the 'class' keyword within its own C# code file. 32 00:01:54,800 --> 00:01:59,560 For the namespace, use "Treehouse.MediaLibrary". 33 00:01:59,560 --> 00:02:02,030 Once you've stubbed out the media type classes 34 00:02:02,030 --> 00:02:06,510 then add at least two public fields to each media type class. 35 00:02:06,510 --> 00:02:10,910 Remember, to add a field to a class you use an access modifier, 36 00:02:10,910 --> 00:02:13,170 a data type, and a name. 37 00:02:13,170 --> 00:02:17,510 There are lot's of different fields that you could define for each media type. 38 00:02:17,510 --> 00:02:22,180 For my album, book, and movie media types, I'm going to add the following fields. 39 00:02:22,180 --> 00:02:26,620 For the album media type, I'll add 'Title', and 'Artist' fields for 40 00:02:26,620 --> 00:02:31,510 the book media type, I'll add 'Title', and 'Author' fields, and 41 00:02:31,510 --> 00:02:36,060 for the movie media type, I'll add 'Title', and 'Director' fields. 42 00:02:36,060 --> 00:02:37,450 If you need some inspiration for 43 00:02:37,450 --> 00:02:41,590 fields that you could add, see the teachers notes for some additional ideas. 44 00:02:41,590 --> 00:02:43,460 And that's it for the first challenge. 45 00:02:43,460 --> 00:02:46,400 If you aren't able to fully complete this challenge, 46 00:02:46,400 --> 00:02:49,990 don't worry, I'll show you my solution in the next video. 47 00:02:49,990 --> 00:02:51,800 Good luck, and we'll see you in just a bit.