Overriding a referenced assembly's class

I have assembly A, A has two classes a and b.

A.a uses A.b in some of it's methods.

In my assembly, B, I have two classes B.a and B.b.

B.a inherits from A.a and B.b inherits from A.b.

How would I get B.a to use B.b instead of A.b in the methods that use A.b, without having access to the source code?

Answers


Without having the source code for A, and that A doesn't do anything fancy like use IoC to resolve A.b, you can't. The dependency between A.a and A.b is set at compile time, and there is probably no easy way to intercept that.

If the methods from A.a that use A.b are virtual, then you can override them, and reproduce their functionality using B.b instead.


Without support from A.a? Nothing besides hackery decompilation to IL (ildasm), changing and then recompilation (ilasm). Which won't work if assembly A has a strong name (signed)


Need Your Help

custom map annotation callout - how to control width

ios callouts mapkit

I've successfully implemented the custom map annotation callout code from the asynchrony blog post .

Trapping general UI activity within an iPhone app

iphone cocoa-touch events

I am developing an iPhone app that polls an internet web service. The poll rate will decay from once every 20 seconds to once every 15 minutes if the iPhone is sitting idle in a dock running my