Re: Member Variables Naming Convention
- From: "Dave Sexton" <dave@jwa[remove.this]online.com>
- Date: Sat, 18 Nov 2006 23:36:12 -0500
Hi Jonathan,
Well I was going to look that up again but I see you gave me a trick question. I just stated in
the post you were replying to that I considered references to controls a bit different than
straight variables. Perhaps you didn't read my entire post, eh? We were talking about member
variables.
I read your entire post. No tricks here :)
We are talking about fields (member variables, as you say), which txtFirstName and lblFirstName
certainly are.
How would you name these two Controls?
Well, as I indicated, I consider that a different issue. I haven't decided on this issue for sure,
but I have a tendancy to stick with what I did in VB, which is to include those prefixes.
I don't see it as a different issue at all. They are fields. (but the point is a moot one anyway
since you were right...)
BTW, I found two interesting bullets in a Microsoft document [link below] regarding the use of
hungarian notation and the "_" prefix in field names:
- Do not use Hungarian notation for field names. Good names describe semantics, not type.
I must argue here that my examples of txtFirstName and lblFirstName indicate both type and
semantics. However, I use the notation in other controls even when there is no ambiguity, but I'm
going to try to break that habit for my next project. Do I really need to know that a field is a
Control by looking at its name when I have intellisense and tooltips on hand at all times? - I
don't think so, but I'll see how it goes ;)
- Do not apply a prefix to field names or static field names. Specifically, do not apply a prefix to
a field name to distinguish between static and nonstatic fields. For example, applying a g_ or s_
prefix is incorrect.
"Field Usage Guidelines [.NET Framework]"
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconfieldusageguidelines.asp?frame=true
--
Dave Sexton
.
- Follow-Ups:
- Re: Member Variables Naming Convention
- From: Jonathan Wood
- Re: Member Variables Naming Convention
- References:
- Member Variables Naming Convention
- From: Jonathan Wood
- Re: Member Variables Naming Convention
- From: Michael Nemtsev
- Re: Member Variables Naming Convention
- From: Jonathan Wood
- Re: Member Variables Naming Convention
- From: Dave Sexton
- Re: Member Variables Naming Convention
- From: Jonathan Wood
- Re: Member Variables Naming Convention
- From: Dave Sexton
- Re: Member Variables Naming Convention
- From: Jonathan Wood
- Re: Member Variables Naming Convention
- From: Dave Sexton
- Re: Member Variables Naming Convention
- From: Jonathan Wood
- Re: Member Variables Naming Convention
- From: Dave Sexton
- Re: Member Variables Naming Convention
- From: Jonathan Wood
- Member Variables Naming Convention
- Prev by Date: Re: Member Variables Naming Convention
- Next by Date: Re: Membership providers in dotNet 2.0
- Previous by thread: Re: Member Variables Naming Convention
- Next by thread: Re: Member Variables Naming Convention
- Index(es):
Relevant Pages
|