Class TreeCollection
Specialized collection for working with tree-structured objects
Automatically builds hierarchy when adding nodes
Supports polymorphic trees (objects of different schemes in one tree)
public class TreeCollection : IEnumerable<ITreeRedbObject>, IEnumerable
Inheritance
Implements
Properties
Orphans
Gets orphan nodes (whose parents haven't been added to collection)
public IEnumerable<ITreeRedbObject> Orphans { get; }
Methods
Add(ITreeRedbObject)
Adds node to collection and automatically builds hierarchy
public void Add(ITreeRedbObject node)
AddRange(IEnumerable<ITreeRedbObject>)
Adds range of nodes
public void AddRange(IEnumerable<ITreeRedbObject> nodes)
FindNodes(Func<ITreeRedbObject, bool>)
Finds nodes by predicate
public IEnumerable<ITreeRedbObject> FindNodes(Func<ITreeRedbObject, bool> predicate)
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<ITreeRedbObject> GetEnumerator()
GetFlattenedWithLevels()
Gets flattened list of all nodes with level indication
public IEnumerable<(ITreeRedbObject Node, int Level)> GetFlattenedWithLevels()