Deleting Objects

Add the following lines at the end of the code in the last step:

pm.Delete(lstEmployee);
pm.Save();

This deletes all Employee objects in the list. You can check it by querying all employees once more:

PersistenceManager pm = new PersistenceManager();
NDOQuery<Employee> q = new NDOQuery<Employee>(pm);
if ((decimal)q.ExecuteAggregate("oid", Query.AggregateType.Count) == 0)
    System.Console.WriteLine("Employees deleted");