static void Main(string[] args) { //delegate calling /*HelloFunctionDelegate hrd = new HelloFunctionDelegate(Hello); * hrd("Rabbi");*/ //delegates usage List <Employee> listEmployee = new List <Employee>(); listEmployee.Add(new Employee() { Id = 1, Name = "Rabbi", Salary = 5000, Experience = 5 }); listEmployee.Add(new Employee() { Id = 2, Name = "Tuhin", Salary = 4000, Experience = 4 }); listEmployee.Add(new Employee() { Id = 3, Name = "Riaz", Salary = 6000, Experience = 6 }); listEmployee.Add(new Employee() { Id = 4, Name = "Puspo", Salary = 3000, Experience = 3 }); IsPromotionPosible isPromotable = new IsPromotionPosible(promotion); Employee.EmployeePromotion(listEmployee, isPromotable); }
public static void EmployeePromotion(List <Employee> listEmployee, IsPromotionPosible isEligiblePromotion) { foreach (Employee employee in listEmployee) { if (isEligiblePromotion(employee)) { Console.WriteLine(employee.Name + " " + "Promotion"); } } }