Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Microsoft launches new open source codeplex foundation
Message
 
 
À
01/10/2009 11:35:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01424841
Message ID:
01427127
Vues:
70
>>>It's also common to see camel case used for private variables - in fact backing fields often have the same name (differing only by case) as their public counterpart. E.g:
>>
>>>public string SomeProperty
>>>{
>>>   //////
>>>}
>>>private string someProperty;
>>
>>>Personally I like this construct - it's easy to identify the link between the two names elsewhere in code.

>>
>>Personally, I don't like the "lower camel case" variation (http://en.wikipedia.org/wiki/CamelCase). The "upper camel case" variation is what's also known as Pascal case and that is what I always use.
>>
>>I also go way back when it comes to naming fields for properties ... I prefer to use the "m_" convention. So, your example would look like this for me:
>>
>>
>>public string SomeProperty
>>{
>>   //////
>>}
>>private string m_SomeProperty;
>>
>>
>>I also dislike the variation of this that seems to be quite popular and that is just using the underscore, so it becomes:
>>
>>
>>public string SomeProperty
>>{
>>   //////
>>}
>>private string _SomeProperty;
>>
>>
>>I dunno ... it just seems harder to read. But maybe that's just me.
>
>Hi,
>Watch out. You'll have the MS thought-police on your case !
>The MS guidelines say 'don't use an underscore' - but without giving a reason for the advice.

I wonder if it might be a holdover from C++? C++ reserves names beginning with a single underscore for the use of the compiler. C# will not accept a double underscore prefix but single is okay.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform