public class CircularList<T> : IList<T>, IList, ICollection<T>, ICollection
{
public CircularList(ICollection<T> collection)
{
int bufCount = collection.Count;
AliveCount = bufCount;
if (bufCount < 8)
{ bufCount = 8; }
BufCount = bufCount;
QArray = new T[bufCount];
collection.CopyTo(QArray, 0);
}
}
var rawType=typeof(CircularList<>);
var genericType=rawType.MakeGenericType(typeof(string));
Activator.CreateInstance(genericType,{your instace here});
构造函数中的collection也如法炮制带到上面的CreateInstance中,外边套个字典做下cache减轻反射负面影响。