public class MyClass<T>
{
public T this[int index]
{
get
{
...
}
set
{
...
}
}
public void MyMethod<T>()
{
int middleIndex = ...;
T value = this[middleIndex ];
...
}
}
The code won't compile because of the statement in MyMethod(). Is there another way of calling the indexer ?
Edit: Modified MyMethod()
Edit2: Compilation error
Error 6 Cannot implicitly convert type 'T [C:\MyClass.cs]' to 'T [C:\MyClass.cs]'
Thanks.