I am writing a small piece of code to serialize classes to binary that can be deserialized into an object without knowing the type on the receiving side. The type is defined in the assembly, but you don't have to provide it in the method call (e.g. Deserialize<MyType>()
). I want to create some sort of a dictionary that allows me to get a Type
from an int
, and the corresponding int
from a Type
. Is there an object in .Net that does this?
I currently have a class with two private
dictionaries and some methods to handle and validate the addition and removal of the synchronized dictionaries. The problem is, that's what I'm trying to avoid (duplicating data).
Edit: The solution proposed in the "Potential duplicate" is basically doing what I already am doing. I'm asking if there is a special dictionary class already doing this, which would allow one-to-one relations without duplicating every key and value.