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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.