If you mean it in terms of time, the lock will be implemented the first time MoveNext() called and will be released either when MoveNext() called for the 11th time (i.e. when the loop ends), or when the iterator is located.
For instance:
var iterable = Values(); // Lock is *not* acquired yet... foreach (var item in iterable.Take(5)) { // Lock has been acquired } // Lock has been released even though we didn't get to the // end of the loop, because foreach calls Dispose
In general, it is a bad idea to block iterator blocks because of this - you really want to block a short, easily understood period of your program.
source share