The following signature allows Add to take any T that implements I<> with any type parameters.
void Add<T,S>(T obj) where T : I<S> { }
The disadvantage of using this method signature is that type inference does not work, and you need to specify all type parameters that look completely stupid:
blah.Add<I<int>, int>(iInstance);
A simpler approach is to use a signature:
void Add<T>(I<T> obj) { }
source share