Question

I need to get data from dictionary that is in format like this :

private Dictionary<string, Dictionary<string, string>> MyDictionary = new    Dictionary<string, Dictionary<string, string>>()
{
    {"HEIGHT", new Dictionary<string,string>(){{"table", "TR_HEIGHT"}, {"prefix", "HEI"}}},
    {"WEIGHT", new Dictionary<string,string>(){{"table", "TR_WEIGHT"}, {"prefix", "WIL"}}},
    {"LENGTH", new Dictionary<string,string>(){{"table", "TR_LENGTH"}, {"prefix", "LEN"}}},
};

It is posible to if I insert "HEIGHT" i get back prefix is "HEI" and table is "TR_HEIGHT"?

Thank's

Était-ce utile?

La solution

It is posible to if I insert "HEIGHT" i get back prefix is "HEI" and table is "TR_HEIGHT"?

Yes

Dictionary<string, string> heightAttr = MyDictionary["HEIGHT"];
string table  = heightAttr["table"];    //  TR_HEIGHT
string prefix = heightAttr["prefix"];   //  HEI
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top