Home Help Center

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

GravitasGravitas Member Shane TolmieOrganization: Software HouseProject: Server modules in C++, C# and Java, to client. ✭✭
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

  • dwaynedwayne St. John's, NewfoundlandMember Dwayne BooneOrganization: ZeroC, Inc.Project: Internet Communications Engine
    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.
  • GravitasGravitas Member Shane TolmieOrganization: Software HouseProject: Server modules in C++, C# and Java, to client. ✭✭
    Excellent - thanks!
Sign In or Register to comment.