using System.Collections;
using System.Collections.Generic;
public static void Main()
Console.WriteLine("Hello World");
List<Person> students = new List<Person>();
students.Add(new Person("Adam", 18, 180, "1960-01-05"));
students.Add(new Person("Billy", 19, 190, "1984-12-11"));
students.Add(new Person("Cristina", 16, 260, "1955-07-04"));
students.Add(new Person("Debbie", 19, 210, "1984-12-11"));
foreach (Person student in students)
Console.WriteLine(student.ToString());
public class Person: IComparable<Person>
public DateTime BirthDate;
public Person(string name, int age, int weight, string birthdate)
BirthDate = DateTime.Parse(birthdate);
public int CompareToXXX(Person otherPerson)
if (this.Age > otherPerson.Age)
public int CompareTo(Person otherPerson)
if (DateTime.Compare(this.BirthDate, otherPerson.BirthDate) > 0)
public override string ToString()
return "Name=[ " + Name + " ] Age=[ " + Age.ToString() + " ] Weight=[ " + Weight.ToString() + " ] BirthDate=[ " + BirthDate.ToString("yyyy-MM-dd") + " ]";