Class met index
Indexer,
Met een indexer kun je ervoor zorgen dat je data in een class aan de hand van een index terug gevonden / gehaald kan worden.
Voorbeeld:
class SampleCollection { private T[] arr = new T[100]; public T this[int i] { get { return arr[i]; } set { arr[i] = value; } } } // voorbeeld class class Program { static void Main(string[] args) { SampleCollection stringCollection = new SampleCollection(); stringCollection[0] = "Hello, World"; System.windows.forms.messagebox.show(stringCollection[0]); } }