Good开发者_C百科 morning,
Is there any good, efficient and good-performance n-ary tree data structure implementation for C#? I don't need any flexibility regarding the type of the nodes, since I only need to store strings. However, I would like fast lookup time. Also, I need to label "edges" of the tree with (short) integers, but these labels can well be stored at each node.
Thank you very much.
Have you tried this?
public class CustomTreeNode
{
public String Label { get; set; }
public List<CustomTreeNode> Children { get; set; }
}
Also, you can always try TreeNode class.
Not directly, but there's a pretty good example here:
Tree example
You can use XElement to build a tree. This is not exactly what you are looking for, but still it can be useful.
http://msdn.microsoft.com/en-us/library/bb387089.aspx
精彩评论