Code Comments
Programming Forum and web based access to our favorite programming groups.Hi all, I have the following problem: I have 2 namespaces: NamespaceA in ProjectA, and NamespaceB in ProjectB. NamespaceA contains class ClassA, which contains a field of type NamespaceB.ClassB. And the other way around: NamespaceB contains ClassB, containing a field of type NamespaceA.ClassB. The compiler gives an error saying, that I am missing the assembly references. So I add ProjectB to the references of ProjectA, and after that try to add ProjectA to the references of ProjectB, which Visual Studio does not enable me to do, saying, that there would be a circular depency. How can I solve this problem? Regards, Krzysztof Kozlowski
Post Follow-up to this messageCould you be more specific as to what these classes are and what they do?
Post Follow-up to this message> I have the following problem: I have 2 namespaces: NamespaceA in ProjectA, > and NamespaceB in ProjectB. NamespaceA contains class ClassA, which > contains a field of type NamespaceB.ClassB. And the other way around: > NamespaceB contains ClassB, containing a field of type NamespaceA.ClassB. > The compiler gives an error saying, that I am missing the assembly > references. So I add ProjectB to the references of ProjectA, and after > that try to add ProjectA to the references of ProjectB, which Visual > Studio does not enable me to do, saying, that there would be a circular > depency. How can I solve this problem? > > Regards, > > Krzysztof Kozlowski > The only way to do this is to use interfaces in at least one of the projects. I am not sure how this would ever work though. ClassA ItemB ItemA ItemB1 ItemA1 ... for ever This is a bad thing. It seems like you have a base set of information that 2 classes need. The fact that C# does not create the actual class right away saves you from that, but somehow you have to tell the ItemB that you do not want to create an ItemA when you create it in a parent ItemA. The following would seem a more logical class layout. ClassA - all the items and information ClassBChild will have to access (or your ClassB in existing class) ClassB - all the items and information ClassAChild will have to access (or your ClassA in existing class) ClassAChild ClassB item ClassBChild ClassA item
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.