Beispiel #1
0
        public void Generate(SourceWriter writer)
        {
            foreach (var @using in this.Usings)
            {
                @using.Generate(writer);
            }

            writer.ConditionalEmptyLine(this.Usings.Count > 0);

            foreach (var @namespace in this.Namespaces)
            {
                @namespace.Generate(writer);
            }
        }
Beispiel #2
0
        public void Generate(SourceWriter writer)
        {
            writer.WriteModifiers(this.Modifiers);
            writer.WriteLine($"class {this.Name}");
            if (this.InheritsFrom.Count > 0)
            {
                writer.StartIndent();
                writer.Write(": ");
                writer.Write(string.Join(", ", this.InheritsFrom));
                writer.EndIndent();
                writer.WriteLine();
            }
            writer.StartScope();

            foreach (var field in this.Fields)
            {
                field.Generate(writer);
            }

            writer.ConditionalEmptyLine(this.Fields.Count > 0);

            foreach (var constructor in this.Constructors)
            {
                constructor.Generate(writer);
                writer.WriteLine();
            }

            foreach (var property in this.Properties)
            {
                property.Generate(writer);
                writer.WriteLine();
            }

            foreach (var method in this.Methods)
            {
                method.Generate(writer);
                writer.WriteLine();
            }

            writer.EndScope();
        }