Features
- Retrieve XML documentation from symbols
- Automatic
inheritdocexpansion - Support for
crefandpathattributes - Type parameter reference rewriting
- Circular reference prevention
Basic Usage
Inheritdoc Expansion
The library automatically resolvesinheritdoc elements:
Supported Scenarios
| Pattern | Resolution |
|---|---|
<inheritdoc/> | Base member, interface implementation, or override target |
<inheritdoc cref="Member"/> | Specified member’s documentation |
<inheritdoc path="/summary"/> | Only the specified XPath elements |
Automatic Synthesis
For symbols without documentation that are eligible for inheritance:GetDocumentationComment
Full signature with all options:| Parameter | Description |
|---|---|
compilation | The compilation containing the symbol |
preferredCulture | Culture for localized documentation (null for default) |
expandIncludes | Whether to expand <include> elements referencing external files |
expandInheritdoc | Whether to resolve and inline <inheritdoc> elements |
cancellationToken | Cancellation token |
GetSummaryText / GetRemarksText
Convenience methods that extract and normalize specific documentation sections:- Returns
nullif no documentation or section not found - Whitespace is normalized (multiple spaces collapsed to single space)
- XML tags are stripped, leaving plain text
Examples
Generate API Documentation
Copy Documentation to Generated Code
Check for Missing Documentation
Type Parameter Rewriting
When inheriting documentation from generic types, type parameter references are automatically rewritten:Performance Considerations
- Use
expandInheritdoc: falsewhen you don’t need inheritance resolution - Cache
GetDocumentationCommentresults when processing many symbols - The method handles circular
inheritdocreferences without infinite loops
