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

C# fix circular reference

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

   --Enum1  (ReportType)
  --Class3 (Has method "MyMethod")

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?
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.
CipherISAuthor Commented:
Thanks Kaufmed.  That works.  I was trying to  keep all the models in one spot. Oh well.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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