匈牙利表示法和变量名 [英] Hungarian notation and variable names

查看:75
本文介绍了匈牙利表示法和变量名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的大多数变量名,我使用匈牙利表示法确定

之间的一个。但是我可以将哪些名字用于公共和私人

变量?我使用的是prv_varName和pub_varName,但听起来真的很奇怪。我见过以_varName开头的变量名。这是另一种可能吗?


Den

解决方案

我是我一直在使用_VarName作为我的私有变量,我的公共VarName属性

指向,而_varName用于那些没有公共访问者的变量。

所有这一切都在类级别,方法中的任何内容都使用varName。


-

Floyd Burger


Denny <德*** @ crane.com>在消息中写道

新闻:%2 *************** @ TK2MSFTNGP09.phx.gbl ...

对于大多数人来说我的变量名,我使用匈牙利表示法确定一个和另一个之间的
。但是我可以将哪些名称用于公共和私人变量?我使用的是prv_varName和pub_varName,但听起来真的很奇怪。我见过以_varName开头的变量名。那是
另一种可能吗?

Den



这是一个有争议的话题。 .net社区。许多公司

需要匈牙利人为当地和会员变量,但不要使用它们

的财产。


有些人采取是否使用匈牙利语符号作为宗教信仰的文章,如果你不做,可能会变得滥用

正是他们推荐的。忽略它们并使用特定公司标准化的任何特定公司。但请记住,MS

建议不要在.net上使用HN。


2004年5月24日星期一10:51:58 -0400,Denny <德*** @ crane.com>写道:

对于我的大多数变量名,我使用匈牙利表示法确定
之间的一个。但是我可以将哪些名称用于公共和私人变量?我使用的是prv_varName和pub_varName,但听起来真的很奇怪。我见过以_varName开头的变量名。这是另一种可能吗?

Den




我工作的地方,标准就是我们使用匈牙利表示法来表示

成员m_,函数变量和局部变量。我们不会用它来获得物品的
。如果我对成员变量有发言权,我可能只需要使用_。$


周一,2004年5月24日12:06:18 - 0400,Denny <德*** @ crane.com>写道:

我的公司没有真正的标准。由于这个应用程序是从头开始编写的,我可以使用任何类型的表示法。我通常使用HN作为
变量,但我希望能够区分局部变量和公共财产。

" Allen Anderson" <人*** @ sparkysystems.com>在消息中写道
新闻:fk ******************************** @ 4ax.com .. < blockquote class =post_quotes>这是.net社区中一些争论的话题。许多公司要求匈牙利人提供本地和会员变量,但不要将它们用于物业。

有些人会采用是否使用匈牙利表示法作为宗教信仰的文章,如果你没有完全按照他们的建议去做,可能会变得辱骂。忽略它们并使用您特定公司标准化的任何内容。但请记住,MS建议不要在.net上使用HN。

2004年5月24日星期一10:51:58 -0400,Denny <德*** @ crane.com>写道:

>对于我的大多数变量名,我使用匈牙利表示法来确定>中的一个和另一个。但是我可以将哪些名称用于公共和私人
>变量?我使用的是prv_varName和pub_varName,但听起来很简单>奇怪。我见过以_varName开头的变量名。这是另一种可能性吗?
>
> Den
>




For most of my variable names, I use Hungarian notation to determine between
one and the other. But what names can I use for public and private
variables? I was using prv_varName and pub_varName but that sounded really
strange. I''ve seen variable names that begin with _varName. Is that another
possibility?

Den

解决方案

I''ve been using _VarName for my private vars that my public VarName property
point to, and _varName for those variables that don''t have public accessors.
All this at the class level, anything in the methods use varName.

--
Floyd Burger

"Denny" <de***@crane.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...

For most of my variable names, I use Hungarian notation to determine between one and the other. But what names can I use for public and private
variables? I was using prv_varName and pub_varName but that sounded really
strange. I''ve seen variable names that begin with _varName. Is that another possibility?

Den



this is a topic of some debate in the .net community. Many companies
require hungarian for local and member variables but don''t use them
for properties.

Some people take whether to use hungarian notation or not as an
article of religous faith and may become abusive if you don''t do
exactly what they recommend. Ignore them and use whatever your
particular company has standardized on. Remember however, MS
recommends against using HN for .net.

On Mon, 24 May 2004 10:51:58 -0400, "Denny" <de***@crane.com> wrote:

For most of my variable names, I use Hungarian notation to determine between
one and the other. But what names can I use for public and private
variables? I was using prv_varName and pub_varName but that sounded really
strange. I''ve seen variable names that begin with _varName. Is that another
possibility?

Den




Where I work, the standard is that we use hungarian notation for
member "m_", function variables, and local variables. We don''t use it
for properties. If I had my say on the member variables I''d probably
just use _.

On Mon, 24 May 2004 12:06:18 -0400, "Denny" <de***@crane.com> wrote:

There''s no real standard at my company. Since this application is being
written from scratch, I can use any type of notation. I usually use HN for
variables but I want to be able to distinguish between a local variable and
a public property.
"Allen Anderson" <al***@sparkysystems.com> wrote in message
news:fk********************************@4ax.com.. .

this is a topic of some debate in the .net community. Many companies
require hungarian for local and member variables but don''t use them
for properties.

Some people take whether to use hungarian notation or not as an
article of religous faith and may become abusive if you don''t do
exactly what they recommend. Ignore them and use whatever your
particular company has standardized on. Remember however, MS
recommends against using HN for .net.

On Mon, 24 May 2004 10:51:58 -0400, "Denny" <de***@crane.com> wrote:

>For most of my variable names, I use Hungarian notation to determinebetween >one and the other. But what names can I use for public and private
>variables? I was using prv_varName and pub_varName but that soundedreally >strange. I''ve seen variable names that begin with _varName. Is thatanother >possibility?
>
>Den
>




这篇关于匈牙利表示法和变量名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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