![]() flattening my collection), I want to know what is what - i.e., if I am in the Children collection of a folder, I want to know when I hit a FolderNode and when I hit an ItemNode, and then when I recurse through the Children property of an ItemNode, I want to know that I am just dealing with the NodeResult type. ![]() I am thinking that generics is the way to go - but - the problem is that if I query off of the overall hierarchical collection, or rather, if I filter on it, when I am recursively going through each child's children collection (i.e. (7) NodeResult - implements INodeResult - I don't need/want a children property in this class, but, I am willing to have an empty collection hang off of the class if the overall hierarchy can be structured properly.Įssentially, I want one base type for node - and the assumption should be that a node can contain other nodes. (6) INodeResult - derives from INodeBase. The implementation of the Children property should allow it to contain items of the NodeResult type. The implementation of the Children property should allow it to contain items of both the INodeFolder type and INodeItem type. (2) INodeFolder - derives from INodeBase. (1) INodeBase - contains a Children property that is a Collection of itself (INodeBase) I want to create a hierarchical structure that will closely follow the following structure:
0 Comments
Leave a Reply. |