CommentBuilder¶
Build single-line (//) and block (/* */) comments as Roslyn syntax trivia.
See also: BodyBuilder | Emit Overview
Factory Methods¶
| Method | Description |
|---|---|
Empty() |
Create an empty comment builder |
Single-Line Comments¶
// Adds a single // comment (prefix added automatically)
comment.Line("TODO: implement")
// Multiple lines
comment.Lines("First line", "Second line")
Block Comments¶
// Single-line block: /* Validate input */
comment.Block("Validate input")
// Multi-line block:
// /* This validates the input
// * before processing */
comment.Block("This validates the input\nbefore processing")
Usage in BodyBuilder¶
// Simple string comment
body.AddComment("// Dispatch the event")
// Builder-based comment
body.AddComment(c => c
.Line("First line")
.Line("Second line"))