Scenario:
An event is raised in class A that needs to be handled by a method in class B. (currently via a delegate)
The data that gets passed from the event to the method is currently wrapped in class C.
This obviously requires class B to be dependent on class C.
Is there any techniques/refactoring that i can perform in order to remove this dependecy?
e.g. unrolling the data back to simple primitive data types and passing them directly.
unrolling to primitives would work, but be certain that you really do want to remove this dependency. It is perfectly valid for classes A and B to both depend on C if C is a bridge between them, or if C feeds both of them, etc.
unrolling to primitives removes a compilation dependency, but not a data dependency, and may actually be ‘denormalizing’ the design by removing an entity (class C) which is logicially required