﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PlayingWithLINQ
{
    public class Person
    {
        public string FirstName { get; set; } = "";

        public string LastName { get; set; } = "";

        public DateTime DateOfBirth { get; set; } = DateTime.MinValue;
    }
    
    public static class Iteration
    {
        public static void Print(this IEnumerable<Person> results)
        {
            if(results == null)
            {
                results = Enumerable.Empty<Person>();
            }

            Console.WriteLine("Printing..................");
            Console.WriteLine("==================================");

            foreach (Person p in results)
            {
                Console.WriteLine(p.FirstName);

                Console.WriteLine(p.LastName);

                Console.WriteLine($"{p.DateOfBirth:dd-mm-yyyy}");

                Console.WriteLine("==================================");
            }
            Console.WriteLine();
        }
    }
}
