public void CleanUp(ref List <IncludeGraphNode> progressedNodes) { #if DEBUG Debug.WriteLine(Name); #endif // node double for (int i = 0; i < Includes.Count; i++) { var node = Includes[i]; if (progressedNodes.Contains(node)) { Includes.Remove(node); Includes.Add(progressedNodes.First(n => n.Equals(node))); } else { node.CleanUp(ref progressedNodes); } } progressedNodes.Add(this); }