Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Escape pointy brackets in C# XML comments

I'm writing a simple compare function with the following signature:

  /// <summary>
  /// Casts two unsigned integers to signed integers and compares them
  /// </summary>
  /// <param name="arg1">Left side of inequality</param>
  /// <param name="arg2">Right side of inequality</param>
  /// <returns>
  /// LESS_THAN if arg1    <----
  /// </returns>
  private static Inequality Compare(uint arg1, uint arg2)

I would like to put literal inequality symbols where the arrow is without triggering the XML parser. How can I do this?

like image 413
audiFanatic Avatar asked Jul 24 '14 12:07

audiFanatic


2 Answers

If you want to see it in the documentation above the method itself, then you can't, just write it out in full, it's clearer too.

For all other purposes (like code insight, generated documentation, etc.), you can use the literal

&lt;

Use

&gt;

For greater than.

like image 136
Willem van Rumpt Avatar answered Sep 22 '22 00:09

Willem van Rumpt


I cheat. I use these characters: ≪≫

/// <returns>
/// if arg1 ≪ 0 then return Inequality.EQUAL_TO
/// if arg2 == 2 ...etc 
/// </returns>

Also useful for

/// <summary>
/// Checks if the List ≪ Dictionary ≪ int,string≫ ≫ is valid
/// </summary>

Looks OK in intellisense, in your code and in the VS produced documentation.

I keep a snippet that produces the following line

// ≪≫ ⇒ ◄==► ―― ≤ ≥ ... plus a few other specials

like image 23
Paulustrious Avatar answered Sep 22 '22 00:09

Paulustrious