コード例 #1
0
 private static void Like(StackOverflowPost post)
 {
     post.PostLike(1);
     post.PostLike(1);
     post.PostLike(1);
     post.PostDislike(1);
     post.PostDislike(1);
 }
コード例 #2
0
        static void Main(string[] args)
        {
            var post = new StackOverflowPost();

            Title(post);
            Description(post);
            CreationDate(post);

            Like(post);
            Console.WriteLine("Title: {0}\n"
                              + "Description: {1}\n"
                              + "Created on {2}\n"
                              + "{3} people liked your post\n"
                              + "{4} disliked your post\n",
                              post.Title, post.Description, post.CreationDate, post.Like, post.Dislike);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            var post = new StackOverflowPost();

            post.Title           = "Hello, this is my first post!";
            post.Description     = "I am just practing C# fundemantals";
            post.DateTimeCreated = DateTime.Now;

            post.displayPost();

            var repeat = true;

            while (repeat)
            {
                Console.WriteLine($@"
Enter Y to up-vote the post
Enter N to down-vote the post
Enter View to view the post detail
Enter other keys to kill this stupid app :)
");
                var userInput = Console.ReadLine().ToUpper();
                if (userInput == "Y")
                {
                    post.UpVote();
                }
                else if (userInput == "N")
                {
                    post.DownVote();
                }
                else if (userInput == "VIEW")
                {
                    post.displayPost();
                }
                else
                {
                    repeat = false;
                }
            }
        }
コード例 #4
0
 private static void CreationDate(StackOverflowPost post)
 {
     post.PostCreation(DateTime.Now);
 }
コード例 #5
0
 private static void Description(StackOverflowPost post)
 {
     post.PostDescription("This is an intermediate level course");
 }
コード例 #6
0
 private static void Title(StackOverflowPost post)
 {
     post.PostTitle("Welcome to my C# Course");
 }