|
/*
* Created by SharpDevelop.
* User: Pook
* Date: 4/10/2011
* Time: 9:06 AM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
namespace Loyc.Collections
{
/// <summary>
/// Reversed view of IListSource returned from <see cref="LCExt.ReverseView{T}"/>
/// </summary>
[Serializable]
public class ReversedListSource<T> : ListSourceBase<T>
{
IListSource<T> _list;
public ReversedListSource(IListSource<T> list) { _list = list; }
public IListSource<T> OriginalList { get { return _list; } }
public new T this[int index]
{
get { return _list[_list.Count - 1 - index]; }
}
public sealed override T TryGet(int index, ref bool fail)
{
return _list.TryGet(_list.Count - 1 - index, ref fail);
}
public sealed override int Count
{
get { return _list.Count; }
}
}
}
|
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.