そのため、私は最近 C# をいじっていますが、すべてのジェネリック コレクションには少し混乱しています。ツリーのヘッドがキーと値のペアであるデータ構造を表現したいとします。その下にキーと値のペアのオプションのリストが 1 つあります (ただし、これらよりも多くのレベルはありません)。これは適切でしょうか?
public class TokenTree
{
public TokenTree()
{
/* I must admit to not fully understanding this,
* I got it from msdn. As far as I can tell, IDictionary is an
* interface, and Dictionary is the default implementation of
* that interface, right?
*/
SubPairs = new Dictionary<string, string>();
}
public string Key;
public string Value;
public IDictionary<string, string> SubPairs;
}
これは、データをやり取りするための単純なシャントにすぎません。