public delegate void EmployeeHandler(Employee employee); public event EmployeeHandler EmployeeReceived;
第二步是編寫發送事件的代碼:
case MessageType.Employee: Employee employee = new Employee(reader); if (EmployeeReceived != null) form.Invoke(EmployeeReceived, new object[] {employee}); break;