Should you use XML comments on field variables, properties & constructors? [closed]

StackOverflow https://stackoverflow.com/questions/13366400

  •  29-11-2021
  •  | 
  •  

Вопрос

So far I understand that its good practice to XML comment a classes methods but is there a standard for how much you should use XML comments?

Should I be using them to document field variables, properties & constructors or is that just overkill?

Had a look about the web but can't see any hard and fast rules for this sort of thing.

Это было полезно?

Решение

There are two reason to use XML comments opposed to plain English:

  1. If the comments follow the correct format they will show up in IntelliSense, meaning when I use your class I can see that int a is supposed to be the count or whatever the same way I see helpful info when I'm using .NET methods,

  2. If you use the XML formats Microsoft supports you can create html (or other formats of) documentation using SandCastle or similar third party utilities.

So, if you're taking the time to write comments, you may as well make them the XML ones that VS encourages.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top