2

I am trying to add documentation to my C# code. But the following gives me a malformed xml error. I know that the error is because of 'List"Display"'. It's trying to find "/Display". But there won't be a "/Display" because it's a part of my code example. Can someone help me with this? Thank you.

    /// <summary>
    ///   Retrieves a list of <c>Display</c>
    /// </summary>
    /// <example>
    ///   <code>
    ///     List<Display> templates = DisplayManager.GetDisplays();
    ///   </code>
    /// </example>

3 Answers 3

3

Wrap your code in a CDATA block:

///   <code>
///     <![CDATA[
///     List<Display> templates = DisplayManager.GetDisplays();
///     ]]>
///   </code>

or encode the angle brackets:

///   <code>
///     List&lt;Display&gt; templates = DisplayManager.GetDisplays();
///   </code>
Sign up to request clarification or add additional context in comments.

Comments

2

It's quite common to write List{Display} in XML documentation.

Comments

1

Try wrapping yout code content within CDATA

<![CDATA[List<Display> templates = DisplayManager.GetDisplays();]]>

All text in an XML document will be parsed by the parser.

But text inside a CDATA section will be ignored by the parser.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.