I know that when I repeat IEnumerable, I repeat the original set, so if I changed the original set in the next IEnumerable iteration, it counted the modification.
So I wonder how this affects this when I have ordered IEnumerable.
For example, if I have this:
List<MyType> myNoOrderedList
IEnumerable<MyType> myOrderedIEnumerable = myNoOrderedList
.OrderBy(x => x.Property);
foreach(MyType in myOrderedIEnumerable)
{
}
Suppose I have 3 elements in a list, at each iteration in an IEnumerable list is ordered or is only one list ordered once?
What happens if I add or remove an item in Do something? Does IEnumerable have initial ordered items or must order again to have a list change account?
source
share