|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Loyc.Collections
{
/// <summary>A <see cref="IBinumerator{T}"/> that swaps the MoveNext() and MovePrev() methods.</summary>
public struct ReverseBinumerator<T> : IBinumerator<T>
{
IBinumerator<T> _e;
public ReverseBinumerator(IBinumerator<T> realEnumerator)
{
_e = realEnumerator;
}
public bool MovePrev()
{
return _e.MoveNext();
}
public bool MoveNext()
{
return _e.MovePrev();
}
public T Current
{
get { return _e.Current; }
}
void IDisposable.Dispose() { _e.Dispose(); }
object System.Collections.IEnumerator.Current { get { return _e.Current; } }
public void Reset() { _e.Reset(); }
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.