[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

Circual Dependencies problems

Troy

4/8/2008 10:28:00 AM

Hi,

I have some circular dependencies that confuses me. I have 2 interfaces that
uses each others interface. When they are compile within the same assembly
there is no problem(?), but when they are in 2 different assemblies i get the
circular dependency problem (When adding reference!)...

Shouldn't it either work in both senarios or not?

And next question, how do i get around this problem.

TIA

----------------------------

interface IA {
IB Foo();
}

interface IB {
IA Foo();
}

- Compiles with success when in they are in same assembly.
- Failes due to "dependecy problems" when they are in their indivdual
assembly.
1 Answer

Marc Gravell

4/8/2008 10:40:00 AM

0

Circular dependencies are (as you have found) only an issue accross
Assembly boundaries, since that is when references are used.

In reality, this is one best avoided; for example, by pushing all the
offending interfaces into a shared base-assembly that several higher-up
assemblies can reference.

The IDE does not support circular references. If you try hard, you can
get the command-line compiler to do it, but I don't recommend it; it is
almost always the wrong design.

Marc