internal protected void rewindImpl() { if (_iterator != null) { // we can make use of standard foreach enumerator _enumerator = Operators.GetForeachEnumerator(_iterator, true, default(RuntimeTypeHandle)); // _valid = _enumerator.MoveNext(); } }
public virtual void next() { // init iterator first (this skips the first element as on PHP) if (_enumerator == null) { rewind(); } // enumerator can be still null, if iterator is null _valid = _enumerator != null && _enumerator.MoveNext(); }
public virtual void rewind() { if (_iterator != null) { // we can make use of standard foreach enumerator _enumerator = Operators.GetForeachEnumerator(_iterator, true, default(RuntimeTypeHandle)); // _valid = _enumerator.MoveNext(); } }
/// <summary> /// Creates array from PHP enumerator. /// </summary> internal static PhpArray Create(IPhpEnumerator phpenumerator) { Debug.Assert(phpenumerator != null); var arr = new PhpArray(); while (phpenumerator.MoveNext()) { var current = phpenumerator.Current; arr.Add(current.Key.ToIntStringKey(), current.Value); } // return(arr); }