Indexer for ParseTreeNode

Jul 31, 2009 at 8:14 AM

Hello,

Wouldn't be useful if we can write:

nodes[4]

instead of:

nodes.ChildNodes[4]

In ParseTreeNode.cs: 

    public ParseTreeNode this[int index]
    {
        get
        {
            return ChildNodes[index];
        }
    }

Regards,
Zoltan
Coordinator
Aug 1, 2009 at 12:37 AM

I would disagree. The indexer should be implemented in classes that represents lists of some sort, or sets or dictironaries. ParseTreeNode is not a list, it has ChildNodes property which is a list, along with other properties. I think creating default indexer would be confusing and go against accepted guidelines

thanks anyway for the suggestion - keep digging!

Roman