49 lines
881 B
C#
49 lines
881 B
C#
using System;
|
|
|
|
namespace DebuggingEssentials
|
|
{
|
|
public class FastListBase
|
|
{
|
|
public static int maxElements;
|
|
|
|
public static string maxListName;
|
|
|
|
public static FastListBase maxList;
|
|
|
|
protected const int defaultCapacity = 4;
|
|
|
|
public int Count;
|
|
|
|
protected int _count;
|
|
|
|
public static void SetCapacity<T>(FastListBase list, ref T[] items, int capacity, int count)
|
|
{
|
|
T[] array = new T[capacity];
|
|
if (count > 0)
|
|
{
|
|
Array.Copy(items, array, count);
|
|
}
|
|
items = array;
|
|
if (capacity > maxElements)
|
|
{
|
|
maxElements = capacity;
|
|
if (list != null)
|
|
{
|
|
maxList = list;
|
|
maxListName = "<" + typeof(T).Name + ">";
|
|
}
|
|
}
|
|
_ = 1000000;
|
|
}
|
|
}
|
|
public class FastListBase<T> : FastListBase
|
|
{
|
|
public T[] items;
|
|
|
|
protected virtual void DoubleCapacity()
|
|
{
|
|
FastListBase.SetCapacity(this, ref items, items.Length * 2, _count);
|
|
}
|
|
}
|
|
}
|