public void Delete(string search, string path, int pos = 0, string debugging = "") { TraversalOption nextStep = new TraversalOption(Label, search, pos); switch (nextStep.option) { case TraversalOptions.MoveNext: if (NextNode == null) { return; } NextNode.Delete(search, path, pos); break; case TraversalOptions.MoveDown: if (ChildNode != null) { ChildNode.Delete(search, path, pos + nextStep.commonPrefixLength, debugging + Label); Results.Remove(item => item.ComparePath(path)); if (Results.Count == StaticVariables.ResultListLength - 1) { RefillResults(); } if (Results.Count == 0 && NextNode != null) { Items = NextNode.Items; Results = NextNode.Results; Label = NextNode.Label; ChildNode = NextNode.ChildNode; NextNode = NextNode.NextNode; } } break; case TraversalOptions.Found: Items.Where(item => item.ComparePath(path)).ToList().ForEach(item => item.Delete()); Items.RemoveAll(item => item.ComparePath(path)); ResultItems.RemoveAll(item => item.ComparePath(path)); break; default: return; } }