C
C#3y ago
MayoWAA!

List Serialisation

I'm trying to add multiple items to a list by serializing and deserializing to add more items then reserializing it but I think I messed something up cause only one item gets added then when i try and add another it overwrites the original.
9 Replies
Becquerel
Becquerel3y ago
Becquerel
Becquerel3y ago
this is the only place you add anything to a list which is the project passed into the method
MayoWAA!
MayoWAA!OP3y ago
i literally just fixed it as i sent this ☹️ but thank you for replying
Becquerel
Becquerel3y ago
lol curse of asking for help no worries
Thinker
Thinker3y ago
Why are you serializing a list and then immediately deserializing it?
MayoWAA!
MayoWAA!OP3y ago
oh i'm working on an app that helps you upload projects to itch.io and i wanted it to save some data on the projects locally essentially updating the list cause i want the items already in the list to remain so i deserialize the original list then add onto it then reserialize it
pip
pip3y ago
i won't speak for the person above, but i'm fairly sure that you can just remove 2 lines of code in what you wrote
pip
pip3y ago
pip
pip3y ago
you're serializing an empty list, deserializing it into the same empty list, adding something to it, serializing again, then writing it. The serializing + writing part is fine, but the initial serialize + deserialize is redundant if i'm not mistaken
Want results from more Discord servers?
Add your server