Esempio n. 1
0
 public TypeDeclarationSyntax Build()
 {
     var res = (_kind switch
     {
         Kind.Class => (TypeDeclarationSyntax)SF.ClassDeclaration(_name),
         Kind.Interface => SF.InterfaceDeclaration(_name),
         Kind.Struct => SF.StructDeclaration(_name),
         _ => throw new InvalidOperationException()
     }).WithModifiers(_modifiers.Build())
        string Render(Docs docs)
        {
            Type type = new InterfaceType(
                "myFqn",
                "myModule",
                "myInterfaceName",
                "myInterfaceNamespace",
                docs
                );

            TypeDocCommentGenerator generator = new TypeDocCommentGenerator(type);

            SyntaxTrivia docComment = generator.CreateDocComment();
            SyntaxTree   tree       = SF.SyntaxTree(
                SF.InterfaceDeclaration("MyInterface")
                .WithLeadingTrivia(generator.CreateDocComment())
                .NormalizeWhitespace(elasticTrivia: true)
                );

            return(tree.ToString());
        }