Remove element from collection using IEnumerator in C#
<p>I need to remove an element from a list&lt;> in C#. From the previous answers provided, it seems that one has to loop backwards through the collection to achieve this. But, I have an IEnumerator to iterate through elements of the list.
The code is as follows:         </p>

<pre><code>        IEnumerator&lt;Solution&gt; iterator = solutionsList_.GetEnumerator();
        while (iterator.MoveNext())
        {

            Solution element = iterator.Current;
            int flag = dominance_.Compare(solution, element);
            if (flag == -1) { // The Individual to insert dominates other
                // individuals in the archive
                iterator.Remove();} // Delete it from the archive
</code></pre>

<p>It would be very helpful if I could get some way of removing the element from the list&lt;> along with using the enumerator. </p>