public CardType this[ int index] {The property member is defined thus
get { return cards[ index ]; }
set { cards[ index ]= value; }
}
this[ int index ]and is called an indexer, in this case it's an int called index. Each class or struct can have multiple indexers as long as the signatures are unique. The signature is the bit inside square brackets eg [int index]. You might for example want to find the position of a card in the deck and there is a second indexer provided with this signature
this [string value]This calls a function FindIndex() to search the array for a matching short card, e.g. "2D". This only works if the ShortCard bool is set to true. If it is, then a card can be retrieved like this:
CardType C = MyCards["2D"];Unlike other properties, this one always uses the keyword this (ie it refers to an instance of this class- this means it only works with instance objects and NOT static classes. The syntax is very similar to properties with get and set, but includes an indexed field. The general form is shown below, where the indexed field is called arr.
public T this[int i]Just like a property this includes get and set accessor methods to alter or access the private field array or structure. But you must use this for accessing the indexer.
{
get { return arr[ i ]; }
set { arr[ i ] = value; }
}
That completes this tutorial. The next one will be on WinForms.

