净 - 命名控制的更好的办法 - 匈牙利表示法或完全符号,如LBL或标签匈牙利、符号、表示、办法

由网友(久病自愈 -)分享简介:在过去,我们将其命名控件lblFirstName,txtFirstName。 In the old days, we name controls as lblFirstName, txtFirstName. 我看到越来越多的全名状FirstNameLabel,FirstNameTextBox。很明显,它不作任何不同...

在过去,我们将其命名控件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.

阅读全文

相关推荐

最新文章