Part 36 Delegates in c#Part 37 Delegates usage in c#class Progim { public static void Main() { List<Employee> empList = ne ...
Part 36 Delegates in c#
Part 37 Delegates usage in c#
class Progim { public static void Main() { List<Employee> empList = new List<Employee>(); empList.Add(new Employee() { ID = 101, Name = "Mary", Salary = 5000, Experience = 5 }); empList.Add(new Employee() { ID = 102, Name = "Mike", Salary = 4000, Experience = 4 }); empList.Add(new Employee() { ID = 103, Name = "John", Salary = 6000, Experience = 6 }); empList.Add(new Employee() { ID = 104, Name = "Todd", Salary = 3000, Experience = 3 }); Employee.PromoteEmployee(empList); } } class Employee { public int ID { get; set; } public string Name { get; set; } public int Salary { get; set; } public int Experience { get; set; } public static void PromoteEmployee(List<Employee> employeeList) { foreach (Employee employee in employeeList) { if (employee.Experience >= 5) //this is hard code logic, next part we will using delegete replace it. Console.WriteLine(employee.Name + "Promoted"); } } }
原标题:Part 36 to 39 Talking about Delegates in c#
关键词:C#
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。