Sergej Andrejev
Sergej Andrejev

Reputation: 9413

A data-structure for 1:1 mappings in C#

I want to temporary store some mapping data. The mapping is one to one. I saw this was solved in Python by wrapping two dictionaries in one class. In this case the O for getting mapped value would be O(1). I wan't the same thing. Does .Net already have such structure or I have to implement my own with two dictionaries?

Upvotes: 0

Views: 622

Answers (1)

Mehrdad Afshari
Mehrdad Afshari

Reputation: 422102

You have to implement it using two dictionaries. There's no built-in type in the base class library that efficiently supports indexing both by key and value.

Upvotes: 4

Related Questions