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

泄露秘密 提交于 2019-12-24 10:14:51

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/13366400/should-you-use-xml-comments-on-field-variables-properties-constructors

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!