c# - How to modify the contents of a method in .NET -


i'd know if there way in can "shadow" function, following class in assembly reference of current project, cannot modify in way assembly's content.

public class  coordinatespace  public function frompixelsy(byval y single) single     return (me.m_originy + ((y * me.zoomy) / (me.m_dpiy / 100.0f))) end function  public function topixelsy(byval y single) single     dim num2 single = ((y - me.m_originy) / me.zoomy) * (me.m_dpiy / 100.0f)     me.checkoverflow(num2)     return num2 end function   end class 

in addition, within assembly have many calls in many classes following:

public class printer       public function testpx()  boolean        dim c new coordinatespace        return c.topixelsy(18) > 500       end function     end class 

for project need above class return in frompixelsy when call topixelsy occurs.

is there way this? if inherit class , override or shadow these methods, when testpx calls function topixelsy, calling coordinatespace method , not new class' method.

this in vb.net, .net language solution ok. hope clear, thanks!

public class  mycoorspace   inherits coordinatespace    public overrides function topixelsy(byval y single) single     return mybase.frompixelsy(y) end function    end class 

that inheritance

now, decoration in case class sealed (notinheritable in vb.net)

public class  mycoordspace // here of course nice implement same interface coordinatespace, if       private  _cs new coordinatespace()  public function topixelsy(byval y single) single     return _cs.frompixelsy(y) end function    end class 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -