C#C
C#3y ago
Brent

❔ Help Serializing Dictionary

Hi everyone!

I am trying to serialize a Dictionary<Manager, Privilege> so that I can save it to a file and deserialize it afterwards. I need to use a Dictionary for a school project, otherwise I would just store 'Privilege' as a field in the Manager class and use a List instead.

So: The Key for the Dictionary is an instance of the 'Manager' class, the Value is an enum type.
I will include screenshots of both classes in the post.

I was thinking of using a JSON serializer but that doesn't seem to work. What would be the best solution to this? How can I save this Dictionary to a file? Any help would be appreciated, thanks in advance!
image.png
image.png
Was this page helpful?