I have a simple question:
Why the program below does not write the whole array $lines? It is looping forever. I am really confused..
function Get-Current ($enumerator) {
$line = $enumerator.Current
return $line
}
$lines = @('a', 'b', 'c')
$enumerator = $lines.GetEnumerator()
$enumerator.Reset()
while ($enumerator.MoveNext()) {
$line = Get-Current $enumerator
"$line"
}