Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Naming conventions
Message
De
30/10/2003 12:46:54
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00844602
Message ID:
00844607
Vues:
19
Hi Steve,

For the most part, I use "this." for all fields or properties of the class (unless I forget <g>).

I don't know where this convention came from, but if we have a private field that we're exposing with a property, then the field is m_MyFoo and the property is MyFoo.

But, what's standard practice? I dunno ... is there any? <g>

~~Bonnie

>As a reformed Hungarian Notation practitioner, I'm trying to decide on naming conventions to use in my C# code.
>
>Given that it's a strongly-typed language, it makes much less sense to use an initial character to denote data type, so I've pretty much given up any kind of hungarian-ness in my coding.
>
>However, two things I struggle with are:
>
>I'd like some way to distinguish a local variable from a property or field of the class. I've gotten in the habit of always preceding field or property references with "this." which does the trick (and also allows IntelliSense to kick in), but not sure if this is being widely accepted.
>
>The other thing is distinguishing private fields and their associated properties.
>
>I've seen some folks using all lowercase for private fields and PascalCase or camelCase for the associated property, but this makes me a little uncomfortable, though I've used this approach.
>
>What say ye all?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform