title: C# - Call Method in Base Class
body: <p>I have 2 classes:</p>
  
  <pre><code>public class A
  {
      public void WriteLine(string toWrite) { Console.WriteLine(toWrite); }
  }
  
  public class B : A
  {
      public new void WriteLine(string toWrite) { Console.WriteLine(toWrite + " from B"); }
  }
  </code></pre>
  
  <p>In my code I do the following:</p>
  
  <pre><code>B writeClass = new B();
  writeClass.WriteLine("Output"); // I expect to see 'Output from B'
  A otherClass = (A)writeClass;
  otherClass.WriteLine("Output"); // I expect to see just 'Output'
  </code></pre>
  
  <p>I presumed this would work because of <a href="http://msdn.microsoft.com/en-us/library/ms173152%28v=vs.80%29.aspx" rel="nofollow">polymorphism.</a></p>
  
  <p>However, it always writes 'Output from B' every time. Is there anyway to get this to work the way I want it to?</p>
  
  <p><strong>EDIT</strong> Fixing code example.</p>