Hi,
although you provide a method for query children items (void VisitEntries(Action<CFItem> action, bool recursive)), it has some significant drawbacks:
it is impossible to build an effective query, because the loop VisitEntries cannot be interrupted when the query is already satisfied. it must go always through all elements even if it no longer necessary.
it is impossible to use System.Linq to build complex queries on nodes.
The solution would be an implementation of IEnumerable<>. Have look on System.IO.Directory. it has to enumerate as well its sub-Folders and files and it returns IEnumerable<>.
Suggestion: Add following methods to CFStorage:
IEnumerable<CFItem> EnumerateItems(bool recursive);
The implementation must use yield operator in order to cooperate smoothly with System.Linq without causing any redundant allocations.
Hi, although you provide a method for query children items (
void VisitEntries(Action<CFItem> action, bool recursive)
), it has some significant drawbacks:VisitEntries
cannot be interrupted when the query is already satisfied. it must go always through all elements even if it no longer necessary.System.Linq
to build complex queries on nodes.The solution would be an implementation of
IEnumerable<>
. Have look on System.IO.Directory. it has to enumerate as well its sub-Folders and files and it returns IEnumerable<>.Suggestion: Add following methods to
CFStorage
:IEnumerable<CFItem> EnumerateItems(bool recursive);
The implementation must useyield
operator in order to cooperate smoothly withSystem.Linq
without causing any redundant allocations.best!