public void DumpFile(string path) { using (var writer = new StreamWriter(path)) { var namespaces = Instances.GroupBy(x => x.NamespaceString); bool eol = false; foreach (var ns in namespaces) { if (eol) { writer.WriteLine(); } writer.WriteLine("#region namespace {0}", ns.Key); writer.WriteLine("namespace {0}", ns.Key); writer.WriteLine("{"); DumpInstances(ns, writer); writer.WriteLine("}"); writer.WriteLine("#endregion"); eol = true; } if (Instances.Count > 0) { writer.WriteLine(); } Scripts.Dump(writer); } }