I had the same experience. I *always* used an underscore prefix and when we
switched to StyleCop it was the one thing that bugged me and nearly turned
the rule off but decided to try and live with StyleCop standards for a few
weeks rather than explain why we had one exception. Now I can't imagine
having to put an underscore and when I see code using it I think of it as
"old-fashioned". Weird but true.

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Davy J
Sent: Sunday, 31 January 2010 12:52 a.m.
To: ausDotNet
Subject: Re: Friday debate: underscore prefix on instance variable

 

The project that I just finished had all the stylecop rules and code
analysis turned on, the first 2 - 3 weeks were a real pain in the arse but
after a while you get used to it. 

The code was much more readable,  no ambiguities about the private field
name and scoping took care of it.

If you follow the rules exactly it's impossible to have this happen:

public int id;
public int ID { get; set; }

the coding rules just won't let you do that so your argument about other
languages not being able to read the class definition  is null and void. 

Now to convert my own project to the same standard, 2856 errors to
go.........

Davy.



  • RE: Friday debate: underscore prefix on instance variable Mark

Reply via email to