Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Collection Data Structure With 1:1 Key/Value Mapping

Are there any built-in C# data structures that are like a hash table but requires both the Keys and the Values to be unique among each other? I basically want a way to look up my Key object in a table via a unique Value and vice-versa. Next to maintaining two hash tables or iterating over each key in the hash table (which is slow), I cannot think of a better way to implement this.

Is the fact that I even have this request a sign that I am designing something incorrectly in my code?

like image 590
Matthew Ruston Avatar asked Nov 05 '08 19:11

Matthew Ruston


People also ask

Bahasa C digunakan untuk apa?

Meskipun C dibuat untuk memprogram sistem dan jaringan komputer namun bahasa ini juga sering digunakan dalam mengembangkan software aplikasi. C juga banyak dipakai oleh berbagai jenis platform sistem operasi dan arsitektur komputer, bahkan terdapat beberepa compiler yang sangat populer telah tersedia.

C dalam Latin berapa?

C adalah huruf ketiga dalam alfabet Latin. Dalam bahasa Indonesia, huruf ini disebut ce (dibaca [tʃe]).

Bahasa C dibuat pertama kali oleh siapa dan tahun berapa?

Bahasa pemrograman C ini dikembangkan antara tahun 1969 – 1972 oleh Dennis Ritchie. Yang kemudian dipakai untuk menulis ulang sistem operasi UNIX. Selain untuk mengembangkan UNIX, bahasa C juga dirilis sebagai bahasa pemrograman umum.


1 Answers

It's not necessarily a design flaw, but there's nothing built into the framework. Fortunately, there was a very similar question recently, and I wrote an answer which should serve you well.

like image 60
Jon Skeet Avatar answered Sep 26 '22 19:09

Jon Skeet