Join Anton Delsink for an in-depth discussion in this video Implement SocialGraph.GetFollows, part of Object Oriented Programming with C#.
- [Instructor] Now that we have the general structure…of how we expect the social graph to work…let's implement the method for obtaining…the list of users being followed or a specified user,…and then the content from that collection of users.…So going to get follows, press F12, go to definition.…Here we have the social graph, the class of the implements,…the collection that keeps track of who follows who.…And so here on line 23 I'll replace the throw…and this should be fairly simple, right?…We can just return from the follow collection…passing in u1.…
The challenge is what if u1 doesn't actually exist…in that collection?…The documentation tells me if I request the key…and it is not found I will get a key not found exception,…so that's not nice.…What I'd rather return is an anticollection.…So what we would like to do, see if the key exists,…do return the collection otherwise,…return and empty collection.…So let's try a linq statement.…I'll add linq all the way at the top on line one,…go to line two, using System.linq…
- 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
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.