我想在2010年之前聘用的Grid員工中展示。我該怎麼做?我有一個類Employee
與屬性(名字,姓氏,Id和EmploymentDate)檢查日期是否低於2010?
private List<Employee> _employees = new List<Employee>();
private void Form1_Load(object sender, EventArgs e)
{
Employee employee1 = new Employee();
employee1.FirstName = "Etrit";
employee1.LastName = "Bujupi";
employee1.Id = 1;
employee1.EmploymentDay = DateTime.Today;
_employees.Add(employee1);
Employee employee2 = new Employee();
employee2.FirstName = "Urim";
employee2.LastName = "Sadiu";
employee2.Id = 2;
employee2.EmploymentDay = new DateTime(2009, 1, 23);
_employees.Add(employee2);
Employee employee3 = new Employee();
employee3.FirstName = "Dardan";
employee3.LastName = "Mexhuani";
employee3.Id = 3;
employee3.EmploymentDay = new DateTime(2007, 2, 7);
_employees.Add(employee3);
Employee add = new Employee();
if (_employees < System.DateTime.Now)
{
EmployeeGrid.DataSource = _employees;
}
}