Hi,
*background*
I want a class containing an int[][] (a list of sets of integer). This
should be hidden for the user and he/she should be able to insert
his/her favourite data structure so to be a little fancy I thought I'd
do a Ctor like this:
// this is the "core": private int[][] sets;
public MyJaggedIntArr(ICollection<ICollection<int>items)
{
this.sets = new int[items.Count][];
int c = 0;
foreach (ICollection<intset in items)
{
sets[c] = new int[set.Count];
set.CopyTo(sets[c++], 0);
}
}
*the problem*
This works fine if I insert an int[][] into the Ctor, but I was unable
to pass a List<List<Int>I got the following exception:
Argument '1': cannot convert from
'System.Collections.Generic.List<System.Collection s.Generic.List<int>>'
to
'System.Collections.Generic.ICollection<System.Col lections.Generic.ICollection<int>>'
*the question*
Is there some even more basic interface than ICollection that includes
lists and ICollection that I could use? Or should I just make four
constructors?
1 - List<List<Int>>
2 - List<ICollection<Int>>
3 - ICollection<List<Int>>
4 - ICollection<ICollection<Int>>
I also might need to add a fifth one
(5 - int[,])
Or should I just force the user to insert int[][]?
thanks
/Per