Ejemplo n.º 1
0
        private void ExportNamespaces(IEnumerable <Type> types, TypeResolver tr, TextWriter tw)
        {
            var gen = tr.GeneratorForNamespace(_settings);
            var grp = types.GroupBy(c => c.GetNamespace(true));
            var nsp = grp.Where(g => !string.IsNullOrEmpty(g.Key)) // avoid anonymous types
                      .ToDictionary(k => k.Key, v => v.ToList());

            var ww = new WriterWrapper(tw);

            foreach (var n in nsp)
            {
                var ns = n.Key;
                if (ns == "-")
                {
                    ns = string.Empty;
                }
                gen.Generate(n.Value, ns, tr, ww);
            }
            tw.Flush();
        }
Ejemplo n.º 2
0
        private void ExportNamespaces(IEnumerable<Type> types, TypeResolver tr, TextWriter tw)
        {
            var gen = tr.GeneratorForNamespace(_settings);
            var grp = types.GroupBy(c => c.GetNamespace(true));
            var nsp = grp.Where(g => !string.IsNullOrEmpty(g.Key)) // avoid anonymous types
                .ToDictionary(k => k.Key, v => v.ToList());

            var ww = new WriterWrapper(tw);
            foreach (var n in nsp)
            {
                var ns = n.Key;
                if (ns == "-") ns = string.Empty;
                gen.Generate(n.Value, ns, tr, ww);
            }
            tw.Flush();
        }