将一个数组反转通过算法去实现虽然可以简化但是如果实际项目中使用还有一种更快速的办法简单有效
public class ReverseList<T> : IList<T>
{
private IList<T> _list;
public ReverseList(IList<T> list)
{
this_list = list;
}
public T this[int index]
{
get
{
return _list[thisCount index];
}
}
}
//test
DateTime t = DateTimeNow;
IList<int> list = new List<int>();
for (int i = ; i <= * ; i++)
{
listAdd(i);
}
DateTime t = DateTimeNow;
list = new ReverseList<int>(list);
DateTime t = DateTimeNow;
ConsoleWriteLine(Create Array:{} ((TimeSpan)(t t))TotalMilliseconds);
ConsoleWriteLine(Reverse Array:{} ((TimeSpan)(t t))TotalMilliseconds);
ConsoleWriteLine(list[]);
ConsoleReadKey();