Advertisement
grubcho

Sorted dictionary - dates

Jul 9th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Events
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var events = new SortedDictionary<DateTime, string>();
  14.             events[new DateTime(1998, 9, 4)] = "Google's birth date";
  15.             events[new DateTime(2013, 11, 5)] = "SoftUni's birth date";
  16.             events[new DateTime(1975, 4, 4)] = "Microsoft's birth date";
  17.             events[new DateTime(2004, 2, 4)] = "Facebook's birth date";
  18.             events[new DateTime(2013, 11, 5)] = "SoftUni was founded";
  19.             foreach (KeyValuePair<DateTime, string> entry in events)
  20.             {
  21.                 Console.WriteLine("{0:dd-MMM-yyyy}: {1}",
  22.                    entry.Key, entry.Value);
  23.             }
  24.  
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement