Visual Studio XML comments (summary) and special characters

后端 未结 1 1523
面向向阳花
面向向阳花 2021-02-19 18:17

I have a method in a C# / Wpf project and I\'d like to comment / document it using the XML comments like this

    /// 
    /// Initialises Drag &a         


        
相关标签:
1条回答
  • 2021-02-19 18:49

    Remember that the & character has special meaning in xml (the start of an entity). You need to write your comment like this instead (annoying, I know):

    /// <summary>
    /// Initialises Drag &amp; Drop
    /// </summary>
    void initDragDrop()
    {
    
    }
    

    I might be wrong on this next point, but I don't think you can even use a CDATA section to avoid the entity, because it breaks the comments. You must type out the entire &amp; entity.

    0 讨论(0)
提交回复
热议问题