Recently my team began the process of revising out coding standards document. We are revisiting this issue because the standards were developed when we used VB 6 and ASP 3.0. I have offered my opinions to the team, and I’ll post them here. Comments are welcome.
All,
To throw in my opinion, I would agree with the below proposed changes with the following exceptions:
All pulic, protected, or internal interfaces should use PascalCasing.
All private members should use camelCasing.
All private class members should be prefixed with “_”
“p_”, “m_”, “g_”, should not be used, and Hungarian notation should not be used.
For instance:
namespace
GpdsIT.SomeRandomApp {public class IDBadge {
private Guid _uniqueID;
private string _badgeName = string.Empty;
public Guid UniqueID {
get { return _uniqueID; }
set { _uniqueID = value; }
}
public string Name {
get { return _badgeName; }
set { _badgeName = value; }
}
public IDBadge(string badgeName) {
_uniqueID = Guid.NewGuid();
_badgeName = badgeName;
}
}
}
I’ll refer you to the MSDN Design Guidelines for Class Library Developers at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconNETFrameworkDesignGuidelines.asp.
The Naming Guidelines link has naming convention recommendations that support the above rules, and the other links have very valuable information about .Net best practices.