How to serialize ArchivableDictionary (binary)

Hi all,

Is there a way to serialze a ArchivableDictionary.
I thought its serializeable but the error “its not marked as serializable” appears.

GH_Convert.CommonObjectToByteArray works great for one GeometryBase object but not for a group of objects or a collection.

I need a byte to store it in a DataBase BLOB.

Any tip how this works would be great.

You could read the value by key and create your own serializable object from it. Then just serialize it and deserialize it to the object and convert back to dictionary.

Do you have any kind of small example how todo so ?.

Is this what you mean. ?

No, I dont have an example.

It depends mostly on how youactually do it, how you work with your data etc.
Lets say you store parameters per item like mass, color, name etc, you could create a class which mirror all these and can save them to its own properties. From there you can just write a converter from dictionary to class and from class to dictionary.

On how you do that technically, well you just iterate over all key/value pairs in a dictionary and depending on the key, you parse it to the corresponding property of your class.

Thanks for the info will try that.

I ended up with a class that have a dictionary as a property and is marked as [Serializable].
Then i intialized a new object and fill it with key/value this object can then serialzed and deserialized.
Now i can fill the sqlite blob with this object (byte) and can retrieve the geo back…cool.
Thanks again for help.

I added this to the wishlist at
https://mcneel.myjetbrains.com/youtrack/issue/RH-65082