Example

 using System; using System.Collections; namespace Samples { public class MySimpleList: IList { private object[] objects; private int counter = 0; private int modifications = 0; public MySimpleList(int i) { if(i <= 0) throw new ArgumentOutOfRangeException(); objects = new object[i]; } public IEnumerator GetEnumerator() {return new Enumerator(this);} public int Count {get {return counter - 1;}} public bool IsSynchronized {get {return false;}} public object SyncRoot {get {return this;}} public void CopyTo(System.Array array, int index) { objects.CopyTo(array, index); } public bool IsFixedSize {get {return false;}} public bool IsReadOnly {get {return false;}} public Object this[int index] { get { if(index < 0 || index >= counter) throw new ...

Get .NET Framework Standard Library Annotated Reference, Volume 1: Base Class Library and Extended Numerics Library now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.