private void disposeRecursively(DrawNode drawNode) { drawNode.Dispose(); if (!(drawNode is ICompositeDrawNode composite)) { return; } foreach (var child in composite.Children) { disposeRecursively(child); } }