Is this an object?
To a large extent. There is no general interface or class that you can use, so object is the only thing guaranteed in the general hierarchy.
What if the indexed object cannot be obtained from the object?
This is not possible in .NET. System.Object is the basic type of all types, and values can always be considered as an object (even if this requires a box to work).
However, passing through an object will not provide access to the index, except through reflection.
The only direct way to do this is through dynamic , but that requires .NET 4 (and is not type safe, which means you can get exceptions at runtime).
A better approach would be to provide Func<T, int, string> , which allows you to specify how to extract the value on the call node:
void DoSomething<T>(T object, Func<T, int, string> valueExtractor) { string foo = valueExtractor(object, 0); }
Then call through:
DoSomething(indexedObject, (o,i) => o[i].ToString());
This allows you to pass an object and a mechanism to retrieve the value based on the index on the call site, which works for any type.
Change regarding:
Edit: I'm looking for some forced contracts that force callers to pass objects that implement the mentioned indexer.
There is no built-in contract or interface that these types do not implement, nor any way to restrict a generic one based on the existence of an indexer. You will need a different approach, for example, my suggestion on using a delegate to retrieve a value.