Question

Is there a way to put an XML documentation summary tag on the same line as a constant in a class?

I have a class with a many many constant return values defined and having comment lines between each makes it a little difficult to read and maintain. (This same question would apply for enumeration values.)

The code below shows an example of how my code looks now. I'd like to keep it like this if there's a way.

public class MyUtilClass
{
    public static int  UTIL_SUCCESS         = 0;   // This is an example comment for success.
    public static int  UTIL_WARNING_LEVEL_1 = 1;   // This is an example comment for warning level 1.
    public static int  UTIL_WARNING_LEVEL_2 = 2;   // This is an example comment for warning level 2.
    public static int  UTIL_FAILED          = 3;   // This is an example comment for failure.
}

I'm using http://shfb.codeplex.com/ to generate my documentation.

Thanks!

Was it helpful?

Solution

No, I think you have to include the XML doc above the thing it is documenting. You can, however, have the summary tags and their content on a single line:

/// <summary>Some content</summary>
public static int  UTIL_SUCCESS         = 0;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top