Пример #1
0
 internal void Publish(User user, Post post)
 {
     if (PublishPosts.ContainsKey(user))
     {
         PublishPosts[user].Add(post);
     }
     else
     {
         var posts = new List <Post> {
             post
         };
         PublishPosts.Add(user, posts);
     }
 }
Пример #2
0
 internal void Publish(User user, Post post)
 {
     // if the user exists
     if (PublishPosts.ContainsKey(user))
     {
         // add the post to the existing collection
         PublishPosts[user].Add(post);
     }
     else
     {
         // create a new list of post and add the user
         var posts = new List <Post> {
             post
         };
         PublishPosts.Add(user, posts);
     }
 }