Archived

This forum has been archived. Please start a new discussion on GitHub.

Is it possible to map coments from slice >> C#?

Wondering if its possible to map comments from the slice file into a target language, such as C#.

It would be nice to be able to generate the following, C# standard comments, even if it was just for intellisense support:

/// <summary>
/// Function that does foo.
/// </summary>
/// <param name="foo">A fooey parameter.</param>
/// <param name="boo">A barey parameter.</param>

Granted, this is not a problem with a simple function - but when you have a complex function with many parameters, it is more elegant to describe the parameters using the docs, rather than long parameter names. This makes coding much easier and quicker, and results in cleaner code.

And, in addition, the thought of generating a 50 function interface with no comments attached to the interface is just downright scary.

Comments

  • dwayne
    dwayne St. John's, Newfoundland
    Yes, it is possible to do this. You just need add comments to your slice files in the proper format.
      /**
       * Function description
       *
       * @param p1 A function parameter.
       * @param p2 Another function parameter.
       * @return The function return value.
       * @throws SomeException An exception raised on a certain error.
       **/
      int method(int p1, int p2) throws SomeException;
    

    You can take a look at the Ice Slice files for examples.

    The generated C# code will then have the proper comments as you desire.
  • Excellent - thanks!