示例#1
0
        public override string ToString()
        {
            while (_toDefine.Count > 0)
            {
                GenerateTypeDefinition(_toDefine.Pop());
            }

            var builder = new CodeTextBuilder();

            builder.AppendLine("// NOTE: This file is auto-generated. Any changes will be overwritten.");

            foreach (var e in _builder)
            {
                if (!_options.IgnoreNamespaces)
                {
                    builder.AppendLine($"namespace {e.Key}");
                    builder.OpenScope();
                }

                builder.AppendLine(e.Value.ToString());

                if (!_options.IgnoreNamespaces)
                {
                    builder.CloseScope();
                }
            }

            return(builder.ToString());
        }
示例#2
0
        void SetNamespace(Type type)
        {
            _namespace = type.Namespace;

            if (!_builder.ContainsKey(_namespace))
            {
                _builder[_namespace] = new CodeTextBuilder();
            }
        }
        public override string ToString()
        {
            while (_toDefine.Count > 0)
            {
                GenerateTypeDefinition(_toDefine.Pop());
            }

            var
                builder = new CodeTextBuilder();

            foreach (var e in _builder)
            {
                builder.AppendLine($"namespace {e.Key}");
                builder.OpenScope();

                builder.AppendLine(e.Value.ToString());

                builder.CloseScope();
            }

            return(builder.ToString());
        }