If I have a method as such:
public void Foo<T1, T2>(T1 list)
where T1 : IList<T2>
where T2 : class
{
// Do stuff
}
Now if I have:
IList<string> stringList = new List<string>();
List<object> objectList = new List<object>();
IList<IEnumerable> enumerableList = new List<IEnumerable>();
Then the compiler cannot resolve the generics to select and this fails:
Foo(stringList);
Foo(objectList);
Foo(enumerableList);
And you have to explicitly specify the generics to use as such:
Foo<IList<string>, string>(stringList);
Foo<IList<object>, object>(objectList);
Foo<List<object>, object>(objectList);
Foo<IList<IEnumerable>, IEnumerable>(enumerableList);