Results 1 to 3 of 3

Thread: Problem removing object from collection (RESOLVED)

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2002
    Location
    London
    Posts
    63

    Problem removing object from collection (RESOLVED)

    I have a SortedList called m_FieldMappings.

    All objects in it that are marked 'Delete', i want to remove from the SortedList.

    foreach (FieldMapping map in m_FieldMappings.GetValueList())
    {
    if (map.DBState == enDBAction.Delete) m_FieldMappings.Remove(map.key);
    }

    The problem seems to be that since I am doing a foreach, the collection should not change otherwise you get an enumeration error.

    I'm looking for another way of doing this.
    Last edited by Genie; Aug 18th, 2003 at 06:57 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width