Join Anton Delsink for an in-depth discussion in this video Implement Content.Publish (use case 1), part of Object Oriented Programming with C#.
- [Instructor] Now that we've set up the simplest case…of a user publishing a piece of content,…let's just add the complexity,…which we do expect in the real world,…that a user would publish more than one piece of content.…So go into the Publish method,…we can see here that we publish…to the PublishedPosts collection…by adding a key and a value to a dictionary.…Unfortunately, when we try and add a second post…for the same user, we'll get an exception…because the key would then be duplicated.…And so our dictionary is not supposed…to be just of user and post,…but rather for each user we want a list of posts.…
Now if you're new to generics…this might be a bit challenging,…but just notice that Dictionary here on line 8…takes two type parameters…doing those greater than less than signs.…The first type parameter is User…and the second type parameter is List of Post.…So the second type parameter is itself…a type that takes a type parameter,…List of type Post.…This will be more challenging to work with,…but it more accurately represents…
- Abstract classes
- Processing text with StreamReader
- IEnumerable and yield return
- Windows Forms controls
- Windows Forms with and without the designer
- Adding, organizing, and testing forms
- Creating classes
Skill Level Intermediate
C# Object-Oriented Programming Tips and Trickswith Jesse Freeman58m 39s Intermediate
What you should know1m 10s
1. Theory vs. Practice
2. Examples from .NET
3. Examples from Windows UI
4. Examples from Board Games
5. Examples from the Web
Next steps1m 13s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.