您是否应该在字段变量,属性和字段上使用XML注释?构造函数? [英] Should you use XML comments on field variables, properties & constructors?

查看:75
本文介绍了您是否应该在字段变量,属性和字段上使用XML注释?构造函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止,我了解XML注释类方法的良好做法,但是是否有使用XML注释的标准?

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?

我应该使用它们来记录字段变量,属性&构造函数还是仅仅是矫over过正?

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.

推荐答案

使用XML注释而不是简单的英语有两个原因:

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

  1. 如果注释遵循正确的格式,则它们将在IntelliSense中显示,这意味着当我使用您的课程时,我可以看到int a应该是计数或以其他相同的方式查看有用的信息我正在使用.NET方法,

  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,

如果使用Microsoft支持的XML格式,则可以使用SandCastle或类似的第三方实用程序创建html(或其他格式的)文档.

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

因此,如果您花时间编写注释,则最好使它们成为VS鼓励的XML.

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

这篇关于您是否应该在字段变量,属性和字段上使用XML注释?构造函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆