By creating a Dictionary<int,int>
or List<KeyValuePair<int,int>>
I can create a list of related ids.
By calling collection[key]
I can return the corresponding value stored against it.
I also want to be able to return the key by passing in a value - which I know is possible using some LINQ, however it doesn't seem very efficient.
In my case along with each key being unique, each value is too. Does this fact make it possible to use another approach which will provide better performance?