C#C
C#2y ago
redmoss

How to serialize part of an object with a guid but then deserialize later?

So at runtime, I'll populate a list of objects that have a guid id and a string name and a bool isFlagged. When I serialize, I don't care about the name because it gets created again when the object is instantiated so there's no need to store that data.

But when deserializing, I instantiate the list of objects again, then want to go through each one and, using the guids I saved, set the isFlagged that I had serialized. The problem is, the new instances have new guids so there's no way to map the deserialized data back to their originals.

How should I approach this problem?
Was this page helpful?