public void DataMaintenance(Employee anEmp, DB.DBOperation operation) { int index = 0; //perform a given database operation to the dataset in meory; employeeDB.DataSetChange(anEmp, operation); //perform operations on the collection switch (operation) { case DB.DBOperation.Add: //*** Add the employee to the Collection employees.Add(anEmp); break; case DB.DBOperation.Edit: index = FindIndex(anEmp); employees[index] = anEmp; // replace employee at this index with the updated employee break; case DB.DBOperation.Delete: index = FindIndex(anEmp); // find the index of the specific employee in collection employees.RemoveAt(index); // remove that employee form the collection break; } }