Visual Studio XML comments (summary) and special characters

后端 未结 1 1526
面向向阳花
面向向阳花 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):

    /// 
    /// Initialises Drag & Drop
    /// 
    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 & entity.

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