Code casing question for private class fields
<p>To sum it up, there are two basic trains of thought:</p>

<ul>
<li>The private field should just be <a href="http://en.wikipedia.org/wiki/CamelCase" rel="nofollow">CamelCase</a> to match the .NET guidelines</li>
<li>The private field should be CamelCase but with a _ pre-appended to tell the difference between method scope variables and class scope variables.</li>
</ul>

<h1>Original Post</h1>

<p>Take the following example</p>

<pre><code>public class Class1{

    public string Prop1{
        get {return m_Prop1;}
        set {m_Prop1 = value; }
    }
    private string m_Prop1; // This is standard private property variable name.

    // How do we cap this variable name? While the compiler can figure out same casing
    // it makes it hard to read.
    private Class2 Class2;

    // We camel case the parameter.
    public Class1(Class2 class2){
      this.Class2 = class2;
    }
}
</code></pre>

<p>Here are my stock rules</p>

<ul>
<li>The class name is capitalized (Class1)</li>
<li>The public properties are capitalized (Prop1)</li>
<li>The private field tied to a public property has <code>m_</code> to indicate this. My coworker prefers <code>_</code>. There is some debate if using <code>m_</code> or <code>_</code> should be used at all, as it is like <a href="http://en.wikipedia.org/wiki/Hungarian_notation" rel="nofollow">Hungarian notation</a>.</li>
<li>Private class fields are capitalized.</li>
</ul>

<p>The part I am trying to figure out is what do I do if when the class name of a private field matches the private field name. For example, <em>private Class2 Class2;</em>. This is confusing.</p>

<p>If the private field name is not the same class, for example <em>private string Name;</em>, there isn't much issue.</p>

<p>Or am I thinking about the issue in the wrong way? Should my classes and private fields be named in such a way that they don't collide?</p>

<p>===</p>

<p>The consensus below is to use lower case private property names, but then we have this issue.</p>

<pre><code>class1{
    private string name; // This is scoped to the class.

    public void Set(){
      string firstName; // This is scoped to the method.
      .... // Lot of code.
      // Should use this.name but nothing prevents.
      // Now there is confusion if name is a class property or scoped to the method.
      name = firstName;
}
</code></pre>
