Special chars in C# comments

  • Thread starter Thread starter LellD
  • Start date Start date
L

LellD

It seems not unusual for me that I have special chars like
< (less than) or > (greater than) in C# comments,
especially in <code> sections. For instance,
<code> if(a<b) c=3; </code> should be a valid comment, but
the '<' in the if statement is treated as beginning of a
new XML token and leads to a compiler warning.
Do you have any idea how I can use these characters in C#
comments, without beeing interpreted as XML tokens?

Thanks,
Dirk
 
LellD said:
It seems not unusual for me that I have special chars like
< (less than) or > (greater than) in C# comments,
especially in <code> sections. For instance,
<code> if(a<b) c=3; </code> should be a valid comment, but
the '<' in the if statement is treated as beginning of a
new XML token and leads to a compiler warning.
Do you have any idea how I can use these characters in C#
comments, without beeing interpreted as XML tokens?

Use &lt; instead of <, &gt; instead of >.
 
Back
Top