Time for action – finding out when both doctors shall be present

Follow the given steps:

  1. Go back to the Main() method and change its content as follows:
    Console.WriteLine("Doctor A and Doctor B both shall be available on "); 
    Console.WriteLine();
    HashSet<DateTime> commonDates = AvailabilityOfDoctorA;
    commonDates.IntersectWith(AvailabilityOfDoctorB);
    foreach (DateTime d in commonDates) 
      Console.WriteLine(d.ToLongDateString());
  2. Execute this new program.

What just happened?

You will see the following output:

What just happened?

Before we dig deep to see what caused the output, please note that every time you run this snippet, you shall see different results because the example ...

Get .NET 4.0 Generics now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.