5

Below comment is just a piece of xml comment in VS but my problem is characters like < > that break the xml structure. How can I use them in an xml comment?

/// <param name="index">square index on board which 1<=index<=64</param>
Kate Gregory
  • 18,808
  • 8
  • 56
  • 85
Freshblood
  • 6,285
  • 10
  • 59
  • 96

3 Answers3

5

I would reword it to be more a sentence and less an equation:

/// <param name="index">square index on board, between 1 and 64</param>
Kate Gregory
  • 18,808
  • 8
  • 56
  • 85
  • Between means 1 and 64 included ? – Freshblood Jul 16 '10 at 20:17
  • If you are concerned that your audience for the comment might think a chessboard could be 2 <= index <= 63, you could say "between 1 and 64 inclusive." I think the importance of the comment is really to distinguish "0-63" from "1-64". But word it as you feel you need to for those who will read it. – Kate Gregory Jul 16 '10 at 20:48
4

Try encoding them? using &lt; and &gt;

Psytronic
  • 6,043
  • 5
  • 37
  • 56
  • 1
    I think that will look awful when you're reading the code. I also think more people will read the code than will read the doc you generate from it. – Kate Gregory Jul 16 '10 at 20:49
4
/// <param name="index">square index on board which 1&lt;=index&lt;=64</param>

OR

/// <param name="index">square index on board which 1〈=index〈=64</param> 

The latter option is unicode: 〈 〉

Joshua
  • 40,822
  • 8
  • 72
  • 132
  • Why use unicode if less than and greater than are part of the xml spec? Not a criticism, just a wonder. – Psytronic Jul 16 '10 at 20:21
  • Depending on fonts, it might be immediately readable both in the comment and the xml extract. – Joshua Jul 16 '10 at 20:46