Inherit the calling class's variables
<p>If I create a private nested class, how can I access the variables and methods from the calling class?</p>

<p>Example:</p>

<pre class="lang-cs prettyprint-override"><code>   public class ClassA
   {
      protected int MyVar=100;

      public MethodA()
      {
         // &lt;some code&gt;
         myObjectClassB.DoSomething(); 
         // &lt;some code&gt;
      }

      private class ClassB
      {
         public DoSomething()
         {
         }
      }
   }
</code></pre>

<p>In the above example I need ClassB to be able to access ClassA.MyVar - Is this possible?</p>
