amre's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
10 (0.01 per day)
Joined:
06-March 12
Profile Views:
365
Last Active:
User is offline Nov 21 2012 10:31 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   amre has not set their status

Posts I've Made

  1. In Topic: delete an item in a list from parameter value

    Posted 21 Nov 2012

    View PostSkydiver, on 19 November 2012 - 05:18 PM, said:

    No you should not and cannot modify the container that you are iterating over using foreach(). If you used a for() loop, you can do the modification. The common pattern though in .NET code is is to use two loops like in this pseudo code:
    List<T> toDelete = new List<T>();
    foreach(T t in targetList)
    {
        if (t is item to be removed)
            toDelete.Add(t);
    }
    
    foreach(T t in toDelete)
    {
        targetList.Remove(t);
    }
    
    


    thank you, with your help I got it working

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

amre hasn't added any friends yet.

Comments

amre has no profile comments yet. Why not say hello?