净 - 命名控制的更好的办法 - 匈牙利表示法或完全符号,如LBL或标签 [英] .Net - Better way of naming control - Hungarian Notation or Full Notation such as lbl or Label

查看:127
本文介绍了净 - 命名控制的更好的办法 - 匈牙利表示法或完全符号,如LBL或标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去,我们将其命名控件lblFirstName,txtFirstName。

In the old days, we name controls as lblFirstName, txtFirstName.

我看到越来越多的全名状FirstNameLabel,FirstNameTextBox。很明显,它不作任何不同。

I'm seeing more and more full names like FirstNameLabel, FirstNameTextBox. Obviously, it doesn't make any different.

我的问题是,微软是否正式推荐使用全名状FirstNameLabel。

My question is whether Microsoft officially recommended using full name like FirstNameLabel.

如果这个问题已经被问,请原谅我。

If this question has been asked, please forgive me.

推荐答案

使用型preFIX是旧的匈牙利命名法天。开发新的应用程序时,它一般不推荐使用。

Using a "type" prefix is of the old Hungarian Notation days. It's generally not recommended for use when developing new applications.

唯一一次我会推荐它是当你的工作与使用的惯例在整个应用程序只是为了保持一致的传统产品。

The only time I would recommend it is when you're working with a legacy product that uses the convention throughout the application just for the sake of consistency.

编辑:

MSDN命名约定的:

不要使用匈牙利命名法。

匈牙利命名法是包括preFIX的标识符EN code有关的参数,一些元数据,如识别的数据类型的做法。

Hungarian notation is the practice of including a prefix in identifiers to encode some metadata about the parameter, such as the data type of the identifier.

这篇关于净 - 命名控制的更好的办法 - 匈牙利表示法或完全符号,如LBL或标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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