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
Post a Comment