A two-way one-to-one lookup for .NET Standard. Like a dictionary, but indexed both ways.
$ dotnet add package BidirectionalMapExactly what it sounds like. This library offers a single class BiMap that let's you define a two-way one-to-one map between values
the same way you would define a one-way map with a dictionary.
using BidirectionalMap;
BiMap<int, string> map = new BiMap<int, string>(){
{1, "Circle"},
{2, "Triangle"},
{3, "Square"},
};
var mappedString = map.Forward[1]; //"Circle"
var mappedInt = map.Reverse["Circle"]; // 1
Well, table-driven value mapping is a very powerfull technique that makes conversions more readable, easier to update, and easier to load from non-code sources.
Some common scenarios for this kind of technique include
Available via nuget at https://www.nuget.org/packages/BidirectionalMap/
Feel free to open an issue to start the conversation.