I'm writing an HTML parser in C# and want to include examples of the HTML that it handles in the summary XML blocks. How do I prevent the < and > characters from messing up the auto-documentation of Visual Studio 2008?
example:
/// <summary>
/// Creates a FlowSegment based on an HTML code, i.e. <bold>
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public FlowSegment(string code)
{
Unfortunately the example causes the tool tip for this constructor to display (in part):
XML comment includes invalid XML
instead of the summary comment.
How can I escape the < and > characters?
The best solution I found was to change it so as to replace < with <
and > with >
as found in the XML specifications.
That makes the example look as follows:
/// <summary>
/// Creates a FlowSegment based on an HTML code, i.e. <bold>
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public FlowSegment(string code)
{
Which makes the desired tool-tip display properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With