I'm trying to implement a Baudot character encoding. Right now, I'm using 2 dictionaries which are simply mirrors of each other:
Dictionary<char, int> Lookup = new Dictionary<char, int> {
{ ' ', 0x100100 },
{ '-', 0x011000 },
{ '/', 0x010111 },
{ '0', 0x001101 },
{ '1', 0x011101 },
...
};
Dictionary<int, char> Reverse = new Dictionary<int, char> {
{ 0x100100, ' ' },
{ 0x011000, '-' },
{ 0x010111, '/' },
{ 0x001101, '0' },
{ 0x011101, '1' },
...
};
Is there a built in type that handles this already? Something like:
var lookup = new Lookup<int, char>();
lookup.GetByKey(0x100100);
lookup.GetByValue('c');
I couldn't find anything when I searched for 'reverse lookup' or 'lookup table', everything seemed to be related to DNS or LinqToSql.
(I'm using Baudot because it's necessary for some Cospas Sarsat devices)