textBoxEmployeeName vs employeeNameTextBox [英] textBoxEmployeeName vs employeeNameTextBox

查看:86
本文介绍了textBoxEmployeeName vs employeeNameTextBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您使用哪种命名约定,为什么?

Which naming convention do you use and why?

我喜欢使用employeeNameTextBox,因为:

I like to use employeeNameTextBox, because:

  • 从英语角度看,这似乎更自然.
  • 我发现使用Intellisense查找起来更容易.
  • 该约定类似于用于事件(MouseClickEvent,MouseClickEventHandler)和依赖项属性(VisiblityProperty)的约定.

注意:我使用的是全名而不是缩写(例如"tb"),因为它符合MS的命名约定,即避免使用缩写.

Note: I am using the full name rather than an abbreviation (such as "tb"), because it is in line with MS's naming conventions that say to avoid using abbreviations.

http://msdn.microsoft.com/en-us/library/ms229045.aspx

推荐答案

首先在名称(textBoxEmployeeName)中使用控件类型的唯一原因是为了更轻松地与Intellisense进行分组(然后所有文本框控件将一起显示).除此之外,使用这种方式确实没有任何好处.我发现第二种方法(employeeNameTextBox)更具可读性,并且个人更喜欢这种方法,但是很多人仍然会首先使用控件类型,因为这种方法已经使用了很长时间了.

The only reason to use the control type in the name first (textBoxEmployeeName) is for easier grouping with Intellisense (All textbox controls would then show up together). Beyond that, there really is no benefit to using that way. I find the second way (employeeNameTextBox) more readable and prefer that way personally, but a lot of people will still go with the control type first, since that is the way it was done for a long time.

这篇关于textBoxEmployeeName vs employeeNameTextBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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