public void Dispose() { foreach (var bfType in Types.Where(type => type.Name.StartsWith("<PrivateImplementationDetails>")).ToList()) { Types.Remove(bfType); bfType.Fields.ForEach(bfField => { bfField.GotByMethods.ForEach(m => m.FieldGets.Remove(bfField)); bfField.SetByMethods.ForEach(m => m.FieldGets.Remove(bfField)); Fields.Remove(bfField); }); bfType.Methods.ForEach(bfMethod => { bfMethod.CalledBy.ForEach(m => m.Calls.Remove(bfMethod)); Methods.Remove(bfMethod); }); bfType.Events.ForEach(e => Events.Remove(e)); } BaseCollection <BfType> .Dispose(); BaseCollection <BfAssembly> .Dispose(); BaseCollection <BfMethod> .Dispose(); BaseCollection <BfNamespace> .Dispose(); BaseCollection <BfField> .Dispose(); BaseCollection <BfEvent> .Dispose(); }