简体   繁体   中英

C# xml documentation error

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>

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>

在XML文档中编写List{Display}是很常见的。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM