I have a method in a C# / Wpf project and I'd like to comment / document it using the XML comments like this
/// <summary>
/// Initialises Drag & Drop
/// </summary>
void initDragDrop()
{
}
When I now use this method somewhere in my project and hover the mouse over it, I get the message "XML comment contains invalid XML: At this place, no spaces are allowed" (I translated the text after the colon manually to english, so it may not be literally in your visual studio). I found out the problem is the "&" sign, if I remove it, it works fine. But I want to keep it, so how to I escape it in the XML summary? I tried "\&" but this isn't working.
Thanks for any hint!
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 & 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 &
entity.
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