stevo_ said:If it supports count would it not also support indexed based access? and I agree.. personally readonlycollection makes me cringe.. I don't like exposing it, and it can only ever then act as runtime protection.. I would love some readonly interfaces for data structures.. and perhaps even some immutable data structure interfaces and implementations (surely the implementations already exist in f# for example).TommyCarlier said:*snip*
No it wouldn't have to support index-based access. Just look at ICollection<T>: you can enumerate it (via IEnumerable<T>), it has a Count-property, but also an Add(T)-method and some additional members (like Remove() and IsReadOnly). Yet it doesn't have index-based access. That's what IList<T> is for.
Now: IEnumerable<T> « ICollection<T> « IList<T>
What I'd like: IEnumerable<T> « ICountEnumerable<T> «
ICollection<T> « IList<T>