c# - data structure for multi-key data? -
Is the data structure commonly used for multi-key data? Like (Key1, key2, ..., keyN) -> Value I used to use dictionaries (C # in dictionary), and then wrote my own cover above it, so the syntax seems to be a bit good. But it seems that I still have to write a cover for each N-dictionary, where N is the number of keys, because I have to define the nested dictionary structure in the code.
Considering that I am using C #, there is a data structure that better encapsulates this type of use, and hashtable-like lookup can be an arbitrary number of keys with display ? I just can not add all the keys to the same unique key, because I should be able to do something like this: foreach key2 [key1] data in foreach key3 [key1] [Key2] data [Fore key4] [key1] [key2] [key3]
No, < / P>
- Dictionary of dictionaries -
dictionary & lt; T1, dictionary & lt; T2, TRS & gt; & Gt;
- Dictionary of Tuples -
dictionary & lt; Tupal 3 & lt; T1, T2, T3 & gt ;, RAS & gt;
Note - Contrary to F # where youMap & lt; T1 * T2 * T3, Res & gt;
- You can not type a triple type in C # - you want to apply it as a normal category or Struct.
But about your example code, the accelerated dictionary (dictionaries dictionary) is the only option.
Comments
Post a Comment