I need to create a generic collection of generic collections, that should contain a generic class. I've tried hard, but haven't found any answers.This is how my realizated collection looks like: https://github.com/Infatum/PMC-Data-Model/blob/master/WTF/Position.cs This is the collection of position of a generic class Point. I need to create an indexed collection of Positions called Matrix, indexed collection of Matrix called Container and an indexed collection of Containers, named Containers. Please, help me!
public class Matrix<T> : ICollection<T> where T : Position<T>
{
protected ArrayList matrix;
protected bool isReadOnly;
public Matrix()
{
matrix = new ArrayList();
}
// ...
}
The trouble : The type 'T' cannot be used as type parameter 'T' in the generic type or method 'Position'. There is no implicit reference conversion from 'T' to 'WTF.Point'
This is actually the task, that was given to me: https://docs.google.com/document/d/1ZYXXAjrh0OYNLUuFy0HT6ZuAzISIecE73cgA4QoRDlc/edit#heading=h.nwbuqfwpq3gk