ChangeableListTests AddElementWhileEnumeratingInInnerLoop Method Delta Engine Documentation

Namespace: DeltaEngine.Tests.Extensions
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void AddElementWhileEnumeratingInInnerLoop()
Examples

[Test]
public void AddElementWhileEnumeratingInInnerLoop()
{
    foreach (int num in list)
    {
        if (num == 5)
            foreach (int num2 in list)
                if (num2 == 1)
                    list.Add(10);
        Assert.AreEqual(3, list.Count);
    }
    Assert.AreEqual(4, list.Count);
    list.Remove(10);
    Assert.AreEqual(3, list.Count);
}
See Also