Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Errrhhh ..... CSharp or VB
Message
De
27/09/2011 21:18:52
 
 
À
27/09/2011 05:09:16
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01524423
Message ID:
01524993
Vues:
63
>>>But for C# using the '_' prefix adds nothing......
>>
>>it easily shows the scope of the variable...
>
>True. But I still can't find a MS link that actually advocates it although I've seen a few (as in the above) that imply that they do not....

I didn't find anything that would indicate that they would advocate it. So I would think they don't.

I do use it for private backing fields, just adding the _ in front of the property name. (I leave the rest in pascal case)

public property FooBar
private field _FooBar
parameter fooBar
local var foobar

I prefer that because property names are sometimes a single word so with:

public property Foo
private field _Foo
parameter foo
local var foo

only the last 2 can get confused and that's not normally an issue.

Why _FooBar instead of _fooBar... I'm too lazy to bother with lower casing the f <g>

But if I was coding in a team I would do whatever the team does, my personal preferences can be a bit unusual.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform