I read the implementation for MoveNext() in List<T>:
public bool MoveNext() {
List<T> localList = list;
if (version == localList._version && ((uint)index < (uint)localList._size))
{
current = localList._items[index];
index++;
return true;
}
return MoveNextRare();
}
What is the point of copying the reference to list into the local var localList?
If they are both pointing to the same object, why can't you replace all instances of localList with list?