If I have a generic class:
public class MyClass
{
public T Value;
}
I want to instantiate several items such as...
I believe your collection would all have to be of the same MyClass type (as in T would have to be the same), because the compiler won't know what types you'd added to which elements in the collection.
In other words, if you were to add 2 elements to a list:
list.Add(new MyClass());
list.Add(new MyClass());
then try to reference one:
var myItem = list[1];
The compiler doesn't know what generic was assigned to the MyClass list at element 1, because the elements are added at runtime, but the generics are determined at compile time.
I'm pretty sure that what you want to do can't be done.
If you know the number of elements in advance, perhaps you could use a Tuple?