示例#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);
     }
 }