Peter,
In addition to the other comments:
The .NET Design Guidelines for Class Library Developers recommend not
including a prefix, instead simply use projectId field for the ProjectId
Property.
http://msdn.microsoft.com/library/d...s/cpgenref/html/cpconFieldUsageGuidelines.asp
However this guideline has major problems for VB.NET developers (as Bob &
others have noted), plus I find it at odds with the Case Sensitivity
guideline, as IMHO there should be a guideline about not having two members
(method & property, method & nested class, method & delegate, method &
event, event & property, property & field...) that differ only by case.
http://msdn.microsoft.com/library/d.../en-us/cpgenref/html/cpconCaseSensitivity.asp
| Is there a reason for using underscores like this in C#?
I prefer to use m_ as the prefix for field members as that is what I learned
in C++. Also as Eric mentions in his blog below it (a prefix, any prefix)
allows me to know instanly whether an identifier was a field or it was a
parameter or local. (Knowing the difference between parameter & local is
generally not that important to me as my methods are normally shorter).
http://blogs.msdn.com/ericgu/archive/2005/03/09/390791.aspx
Hope this helps
Jay
| Hi
|
| I am looking at some C# code, and can see in some of the classes there are
| instance variables whose names start with an underscore, for example:
|
| private string _projectId;
|
| Is there a reason for using underscores like this in C#?
|
| Thanks,
| Peter
|
|