I've tried to create a simple class implementing IList. However the members are not available unless I first cast DiskBackedCollection to IList. How can I make it usable without casting?
public partial class DiskBackedCollection<T> : IList<T>
{
private List<T> _underlyingList = new List<T>();
int IList<T>.IndexOf(T item)
{
return _underlyingList.IndexOf(item);
}
T IList<T>.this[int index]
{
get
{
return _underlyingList[index];
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
int ICollection<T>.Count
{
get
{
return _underlyingList.Count;
}
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return new DiskBackedCollectionEnumerator(this);
}
IEnumerator IEnumerable.GetEnumerator()
{
return new DiskBackedCollectionEnumerator(this);
}
}