© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
13 replies
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
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ ✅ JsonSerializer not serializing dictionary
C#CC# / help
4y ago
✅ Serializing/Deserializing a Dictionary with a struct key not working
C#CC# / help
15mo ago