I have a method:
internal List<int> GetOldDoctorsIDs
{
var Result = from DataRow doctor in DoctorTable.Rows
where doctor.Age > 30
select doctor.ID
List<int> Doctors = new List<int>();
foreach (int id in Result)
{
//Register getting data
Database.LogAccess("GetOldDoctorsID: " + id.ToString());
if (Database.AllowAccess(DoctorsTable, id))
{
Doctors.Add(id);
}
}
}
So this gets old doctors and does other things. Now I would like to create method GetExpensiveDoctors. It will look like this above, but in place of:
where doctor.Age > 30
I will have:
where doctor.Cost > 30000
How to create elegant, object oriented solution for this? Should I use delegate or other thing?