title: How to modify the contents of a method in .NET
body: <p>i'd like to know if there is a way in which I can "shadow" a function, the following class is in an assembly reference of my current project, i cannot modify in any way the assembly's content.</p>
  
  <pre><code>Public Class  CoordinateSpace
  
  Public Function FromPixelsY(ByVal y As Single) As Single
      Return (Me.m_originY + ((y * Me.ZoomY) / (Me.m_dpiY / 100.0F)))
  End Function
  
  Public Function ToPixelsY(ByVal y As Single) As Single
      Dim num2 As Single = ((y - Me.m_originY) / Me.ZoomY) * (Me.m_dpiY / 100.0F)
      Me.CheckOverflow(num2)
      Return num2
  End Function  
  End Class
  </code></pre>
  
  <p>In addition, within the assembly i have many calls in many classes like the following:</p>
  
  <pre><code>Public Class Printer
        public function testPx() as  boolean
         dim c as new CoordinateSpace
         return c.ToPixelsY(18) &gt; 500
        end function
      End Class
  </code></pre>
  
  <p>For my project I need the above class to return what is in <code>FromPixelsY</code> when a call to <code>ToPixelsY</code> occurs.</p>
  
  <p>Is there a way to do this? If I inherit the class and override or shadow these methods, when testPx calls function ToPixelsY, it would be actually calling CoordinateSpace method and not my new class' method.</p>
  
  <p>This is in VB.net, but any .NET language for the solution is ok.
  Hope this was clear, thanks!</p>