How do I make a list of lists?

Hi

I’ve read a couple of questions about this but none seem to work for me. I have a list of strings created by:

private var wave1 : List.<String> = new List.<String>();

I want several waves, and I want each of those to be stored in a list too. Something like:

private var waveArray : List.< List > = new List.< List >();

Obviously the above line doesn’t work - how should I write this?

Thanks

2 Answers

2

Ah, this works:

private var waveArray : List.< List.<String> > = new List.< List.<String> >();

You gave me the right idea - think the syntax was just a bit wrong.

Cheers

Step 1 : read this page : http://answers.unity3d.com/page/newuser.html Please don't post comments as answers. Post comments by clicking the [add new comment] button, a window then open for you to type in. Answer fields are for answers only, as this is a knowledge base. Here at Unity Answers, Answer means Solution, not Response. Please watch : http://video.unity3d.com/video/7720450/tutorials-using-unity-answers

var l :List<List> = new List<List>;

or it is

var l :List<List<String>> = new ArrayList<ArrayList<String>>;

Neither of those compile for me

I am pretty sure you need brackets after the new List<List<String>>; so it would be new List<List<String>>();