_DeckRooms = New List(Of String)({"This", "is", "a", "test"})
_DeckName = "This is a test"
Dim dict = New Rhino.Collections.ArchivableDictionary(1, "MSPLayerData")
dict.[Set]("DeckRooms", _DeckRooms)
dict.[Set]("DeckName", _DeckName)
archive.WriteDictionary(dict)
While I’m not closing Rhino, it works fine, I can read and write my user data (both my list(of string) and my string variable).
When I close/re-open rhino, my list(of string) Dictionary entries are lost, while my string objects are still there. I’ve got the same issue with every Custom UserData, doesn’t matter where they are stored (One is on the layers, another on the objects…)
Thanks for your help, @dale .
As far as I can understand, your sample attach user data to the doc, it would not work to attach a list(of object) to my layers or rhino object, would it?
I don’t really get the issue with my code actually, since Rhino.Collections.ArchivableDictionary.set() allows IEnumerable(Of String) it should work the exact same way as for storing a single string in the same dictionary, doesn’t it?
Anyway, right now I cheating by storing a string like this:
Dim DeckRoomsCSV As String = ""
For Each tp As String In _DeckRooms
DeckRoomsCSV &= tp & "##"
Next
dict.[Set]("DeckRoomsCSV", DeckRoomsCSV)
And I read it like this:
If dict.ContainsKey("DeckRoomsCSV") Then
Dim DeckRoomsCSV As String = TryCast(dict("DeckRoomsCSV"), String)
For Each tp As String In DeckRoomsCSV.Split("##")
If tp <> "" Then _DeckRooms.Add(tp)
Next
End If