• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 351
  • Last Modified:

C# fix circular reference

I have an app that I'm working  on. Structure is as below

MyApp.sln
--ProjA
   --Class1
   --Class2
   --Enum1  (ReportType)
--ProjB
  --Class3 (Has method "MyMethod")
  --Class4

So, ProjA has references to ProjB.

Lets say in Class2 I'm calling Class3. Want to pass the Enum1 value in  Class3.

So I'm calling MyMethod(ReportType.Static);

In Class3 when I type MyMethod(ReportType reportType)
I receive an error  because  it can't  find "ReportType". If I try to add the reference by right  clicking on  reference and adding by selecting project and selecting "ProjA" I  receive an error indicating a circular reference and I understand why.  

Any idea how to pass the enum to  Class3?
0
CipherIS
Asked:
CipherIS
1 Solution
 
käµfm³d 👽Commented:
Move the definition of the enum to ProjB. The enum is obviously a dependency, so it should be in the independent class.
0
 
CipherISAuthor Commented:
Thanks Kaufmed.  That works.  I was trying to  keep all the models in one spot. Oh well.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now