Have read through the MSDN naming guidelines and could not find a clear answer, other than that you should try to avoid underscores in general. Let's say I have the following:
public class Employee
{
private string m_name; //to store property value called Name
public string Name
{
get { return m_name; }
set { m_name = value; }
}
public void ConvertNameToUpper()
{
//by convention should you use this
return m_name.ToUpper();
//or this
return Name.ToUpper();
}
}
What is the proper naming convention for m_name in the above? For example, in code I inherit I commonly see:
- m_name
- _name
- name
- myName or some other random identifier
Which one (or another) is most commonly accepted?
As a follow-up, in the methods of the class, do you refer to the internal (private) identifier or to the public property accessor?