I have data that I would ideally want to represent as so:
LinkedList<T>[]
However, you cannot do that on generics, so I wrapped it in a struct:
public struct SuitList
{
LinkedList<T> aList;
public SuitList()
{
aList = new LinkedList<T>();
}
}
Now, in my class I have
SuitList[] myStructList; //there is only 4 indices of myStructList
How do I initialize aList, inside my constructor for the class? I tried this as follows:
myStructList = new SuitList[4];
for(int i = 0; i < 4; i++)
{
myStructList[i] = new SuitList();
}
The compiler gave me an error saying Structs cannot contain explicit parameterless constructors. Are there better ways of doing this? Thanks for the help in advance.
LinkedList<T>[]
? There's nothing wrong with it. – phoog