protected virtual void Write(IndentedTextWriter writer, ClassDeclaration type)
        {
            writer.Write("class ");
            WriteIdentifier(writer, type.Name);
            WriteGenericParameters(writer, type);

            var baseTypes = GetBaseTypes(type);

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

            writer.WriteLine();
            WriteGenericParameterConstraints(writer, type);

            writer.WriteLine("{");
            writer.Indent++;
            WriteLines(writer, type.Members.Cast <CodeObject>().Concat(type.Types), endOfLine: null);
            writer.Indent--;
            writer.WriteLine("}");
        }
示例#2
0
 public static T AddMember <T>(this ClassDeclaration c, T member) where T : MemberDeclaration
 {
     c.Members.Add(member);
     return(member);
 }
 public override void VisitClassDeclaration(ClassDeclaration classDeclaration)
 {
     classDeclaration.Members.Sort(MemberComparer.Instance);
     base.VisitClassDeclaration(classDeclaration);
 }