I have some code that builds a class:
return SyntaxFactory
.ClassDeclaration(name)
.AddModifiers(SyntaxFactory.Token(SyntaxKind.PublicKeyword))
.WithMembers(GetProperties());
This all works, and outputs the class that I expect. I'd like to add an XML doc to this:
/// <summary>
/// Some plain text here.
/// </summary>
I don't need anything fancy, just plain text. I'm struggling to find any examples of this, and have been through various overloads of Annotations
, Trivia
, and loads of methods hanging off SyntaxFactory
(XmlComment
, XmlElementStartTag
, DocumentationCommentExterior
, DocumentationCommentTrivia
) with no joy (ironically, none of these have XML Comments!). The closest I got was something that compiled, but crashed at runtime with Unexpected false
!
I'm targetting .NET 4.5, using VS 2015 RC and 1.0.0-rc2 of Roslyn.
You can use RoslynQuoter to see how to do this: