The indexing has nothing to do with the generics - it is only being used with the array you declared:
str
with is declared as an array of the generic type.
If you replace the "generics" in your code with a "standard" type:
int[] str = new int[3];
int count = 0;
public void Add(int value)
{
if (count < 3)
{
str[count] = value;
count++;
}
}
public int this[int index]
{
get
{
return str[index];
}
set
{
str[index] = value;
}
}
Then it's more obvious.
And that's what generics allow you do do: declare code that can be used for any type of data, while maintaining strong typing