how to use dictionary two way in c# -


public static dictionary<int, string> dic = new dictionary<int, string>() {              {1,"anystring1"},             {2,"anystring2"}}; 

i need use this

string str= dic[1]; // possible  int a=dic["anystring1"]; // dream 

that not dictionary meant do. can think of definition , instantly find matching word in favorite dictionary in o(1) time? if want class type of functionality (a bidirectional dictionary) have build (or google 1 of many implementations on internet).


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -