public void DoTheWork() { Manager manager = new Manager(); // Create a new instance of the delegate and pass in the function handler WorkPerformanceHandler handler = new WorkPerformanceHandler(manager.Manager_WorkPerformed); Employee employee = new Employee(); handler += new WorkPerformanceHandler(employee.Employee_WorkPerformed); // Anonymous method can also be used as handler for a delegate handler += delegate(int hours, string workType) { return hours + 3; }; // Anonymous lambda expression, the parameters are passed into the brackets // types don't have to be defined. handler += (hours, workType) => { return hours + 4; }; // Run the delegate by calling it with the required parameters int i = handler(3, "manager"); }
private void detach_Employees(Employee entity) { this.SendPropertyChanging(); entity.JobDescription = null; }
partial void UpdateEmployee(Employee instance);
partial void DeleteEmployee(Employee instance);
partial void InsertEmployee(Employee instance);