Private Member Variable Naming Convention

D

Douglas McCormick

Hello,

We are converting our VB .NET 1.1 code to 2.0. The compiler is issuing many
messages similar to the following:

warning BC40031: Name '_shoppingCartItemID' is not CLS-compliant.

They are all referring to Private Member Variables beginning with an
underscore "_".

In the past, this has been Microsoft's suggested naming convention, so we
have many variables named as such. We would like our assemblies to be
CLS-compliant, but we would also prefer to keep a specific naming convention
for private member variables, so they can be instantly identified as such.
Does anyone have any suggestions as to the new "recommended" naming
convention?

Thanks,
Douglas McCormick
 
P

Patrice

I agve this a try and this is not the behavior I see. If I ask for CLS
compliance I've got a warning for public members but no warning for private
members.Is it really private ?
 
D

Douglas McCormick

Patrice,

You are absolutely right! Those variables are PROTECTED, not Private. (This
is what I get for taking other people's word for things and not
double-checking it myself). 8(
Thank you for looking into this!

Douglas
 
J

Joergen Bech

Design guidelines for Class Library Developers:
http://tinyurl.com/2249l4

or even better, buy the book:
http://www.amazon.com/Framework-Design-Guidelines-Conventions-Development/dp/0321246756

The leading underscore in private fields is mentioned here:
http://www.irritatedvowel.com/Programming/Standards.aspx
(and a zillion other places).

The most important difference between classic VB and VB.Net is
probably that Hungarian notation has been discarded, except perhaps
where controls are concerned.

Regards,

Joergen Bech
 
J

Jeffrey Tan[MSFT]

Hi Douglas,

How about this issue now? Have you reviewed Joergen's reply to you? Does it
make sense to you? If you still need any help or have any concern, please
feel free to tell me, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top