Documentation for a struct parameterless constructor

Jul 25, 2012 at 6:01 AM

As you cannot define a parameterless constructor for a struct in C# (so no XML documentation is generated), is there any other way to generate documentation for it?


Jul 26, 2012 at 8:56 PM

Since a structure cannot have a parameterless constructor, one will never appear in the help file for it thus defining comments for one would be pointless.  You can have parameterized constructors and they work as usual with regard to comments.



Jul 26, 2012 at 9:12 PM

Thanks for the response.

A struct has an implicit parameterless constructor. In my case this initialises the struct to a certain "state", and I have parameterized constructors that initialise it to different states. The documentation for the parameterized constructors is generated correctly, but the documentation for the implicit parameterless constructor isn't immediately obvious if I put it somewhere else (as the user is currently focusing on the constructor documentation).

You could argue that I should convert the struct to a class, but there are specific (and boring) reasons why its currently a struct. I was hoping there would be some way to magically insert this "additional" constructor documentation.