I've attached a picture of what I'm trying to do. Let's say I have a list of T in a class
public class MyClass<T>
where T : IMyInterface
{
public List<T> list = new List<T>;
}
Now, another class has a list of MyClass.
public class AnotherClass
{
public List<MyClass<IMyInterface>> list = new List<MyClass<IMyInterface>>;
}
What is the T that I should put for MyClass? If I put T, then it assumes all types in that class are the same, but it isn't. If I put IMyInterface, I couldn't cast IMyInterface to T when accessing these classes.
new AnotherClass().list.Add(new MyClass<T>());
What is the type here right now? The list in AnotherClass generic type is IMyInterface but the thing I want to add in is T, which T I want to be dynamic but they are still under IMyInterface.

dynamickeyword, but that has nothing to do with generics. aList<int>is a list containing ONLYints.a List<IMyInterface>is a list containing ONLY objects implementingIMyInterface.