private string CompleteWord(string prefix, out CompletionTreeNode node)
        {
            StringBuilder sb = new StringBuilder(100);

            node = this.root;
            if (String.IsNullOrEmpty(prefix))
                return String.Empty;
            // Advance all the prefix on the tree.
            // If a character is not found, the prefix can not be completed so it's returned as is
            for (int i = 0; i < prefix.Length; ++i)
            {
                node = node[prefix[i]];
                if (node == null) return String.Empty;
            }
            // At this point we are done with the prefix.
            // It must go over the three while the corrent node has only one child
            // and untill a EndOfWord is reached
            while (node != null)
            {
                if ((node.Children.Count != 1) || node.EndOfWord)
                    break;
                node = node.First;
                sb.Append(node.Value);
            }
            return sb.ToString();
        }
 public CompletionTree()
 {
     this.root = new CompletionTreeNode((char)0);
 }