private List <CodeTypeReference> GetBaseTypes(CodeClassDeclaration c)
        {
            var list = new List <CodeTypeReference>();

            if (c.BaseType != null)
            {
                list.Add(c.BaseType);
            }

            foreach (var type in c.Implements)
            {
                list.Add(type);
            }

            return(list);
        }
        protected virtual void Write(IndentedTextWriter writer, CodeClassDeclaration type)
        {
            writer.Write("class ");
            WriteIdentifier(writer, type.Name);
            writer.WriteLine();

            var baseTypes = GetBaseTypes(type);

            if (baseTypes.Any())
            {
                writer.Write(" : ");
                Write(writer, baseTypes, ", ");
            }

            writer.WriteLine("{");
            writer.Indent++;
            Write(writer, type.Members, writer.NewLine);
            Write(writer, type.Types, writer.NewLine);
            writer.Indent--;
            writer.WriteLine("}");
        }
示例#3
0
 public static T AddMember <T>(this CodeClassDeclaration c, T member) where T : CodeMemberDeclaration
 {
     c.Members.Add(member);
     return(member);
 }