Dim lLists as new list(of List(of string))
Dim lList1 as new list (of string)
Dim lList2 as new list (of string)
llist1.add("hello")
llist2.add("me")
llists.add(llist1)
llists.add(llist2)
Weird, I thought I tried it that way. But I just tried again and it works so that's good. Thanks.
Hey, do you know what the <> symbols mean that are usually auto-filled when I type List? I just erase that part, but I'd love to know what I'm erasing.
Also, I'm still looking to know how paths are output if anyone knows that one.
Chris, have a read on page 42 of the grasshopper primer - there's an outline on data tree structures.
Basically it's a way to access networks of data paths. vers. 0.7 also now allows for script components (C# / VB) to access data tree's rather than a flattened list.
<> is the symbol for 'does not equal' - not sure why it is dropped in the intellisense after List though?
There's a number of ways you can develop nested data - Nested List; ArrayList; dataTree; etc. Each class may also be more efficient in returning data depending on the search pattern of data contained. If you want to explore further, it would be useful to search the Rhino SDK / RhinoCommon SDK forums.
the <> symbols after DataTree are actually an error of autocompletion. They are meant to be used from C# and are the same as (Of ...) in VB.Net. E.g.: List<Point3d> in C# is the same as List(Of Point3d) in VB.Net.
They mean containing (or working on) Point3ds. You can see Generic Programming on wikipedia for a general introduction. The non-generic version of List<>, known as ArrayList, can contain everything but it slower on certain types and more error prone, as it's more difficult to always predict what a "black box" like ArrayList actually contains.
Yes generic lists are the way to go. I understand that it is more effcient as we know the data it contains beforehand and hence provides an early bound solution, there is no "boxing" and "unboxing" of data.
Is there a difference between a "Nested List" "Linked List" and simply defining a generic list of list - as in my example above? Is this a linked list?
List<Something> is based on an underlying array. Arrays are not resizable, so the array is swapped when the list notices that it has run out of space inside it. At this point, it will pay the cost of copying all the content from the old array to the new one. The current default size for List<Something> is 4 if I remember correctly, but this is just an implementation detail. You can use the constructor with another capacity to change it.
You can also see the .NET Framework Class Library reference for other generic collections, like the LinkedList<Something>.