public static void Main(string[] args) { List <Emplyee> empList = new List <Emplyee>(); empList.Add(new Emplyee() { Id = 101, Name = "Mark", Salary = 10000, Experience = 5 }); empList.Add(new Emplyee() { Id = 102, Name = "Mary", Salary = 10000, Experience = 4 }); empList.Add(new Emplyee() { Id = 103, Name = "Dom", Salary = 10000, Experience = 6 }); empList.Add(new Emplyee() { Id = 104, Name = "Piter", Salary = 10000, Experience = 4 }); empList.Add(new Emplyee() { Id = 105, Name = "Jerry", Salary = 10000, Experience = 5 }); Ispromoted ip = new Ispromoted(Promote); Emplyee.PromoteEmplyee(empList, ip); }
public static void Promote(List <Employee> employeeslist, Ispromoted ispromoted) { foreach (var Employee in employeeslist) { //if(Employee.Experience >= 5 ) HARD CODEED FORM if (ispromoted(Employee)) { Console.WriteLine(Employee.Name + " xIs PROMOTED"); } } }
public static void PromoteEmplyee(List <Emplyee> EmplyeeList, Ispromoted IsEligiableToPromote) { foreach (Emplyee emplyee in EmplyeeList) { if (IsEligiableToPromote(emplyee)) { Console.WriteLine(emplyee.Name + " Promoted"); Console.ReadLine(); } } }