• 0

C# Class library cross reference not allowed?


Question

Hey guys I want to build a DLL that can access all my forms properties and have the forms able to access the dll functions. Microsoft seemed to make

it impossible to do this. Any ideas? I can't add a reference of each other in both projects b/c of some error about how it's create circular speculation...that's what I want...both projects to be able to access both data.

5 answers to this question

Recommended Posts

  • 0

Circular referencing projects can be difficult because of the semenatics behind trying to compile them (which one would you compile first?), and load them. If the libraries will both be dependant on each other, would it not be easier to just compile them into the same project?

One way to get round them is to use an Event based mechanism, but it wouldn't be very pretty:

Project A declares Event 1

Project B creates a handler for Event 1

Project A fires Event 1

Project B catches Event 1

Only Project B is dependant on Project A

Create a custom event handler in Project A, which Project B implements but Project A fires. Make sense?

  • 0

eh...not really. B/c how would I get project b to create a handle out of anything from project a if I can't include both?

I would love to put them in the same project but VS 2005 doesn't allow you to add a .dll file project into an existing Windows Form project.

Is there a link maybe to explain more of what you're talking about?

  • 0

Visual Studio 2005 allows both kinds of projects to be in the same solution. The way antaris described it the 2 projects won't need to include each other. Only Project B would need to include Project A.

  • 0

Honestly, this doesn't sound like a good design. You can work around this, though.

My first thought, and I didn't get much sleep so forgive if I'm not clear, is to create a base class or interface that your forms implement inside another DLL. This base should include all the properties you want to expose to the primary DLL. Have your primary DLL reference this abstract type instead of the concrete type. Your Win form project should reference this, too, of course. Now your primary dll can be reference by your Win form app and your win form app can pass in the base type to your primary dll. You've created a triangular reference instead of a circular one. ;)

You should really rethink your design, though. If that much data and functionality really needs to be shared between 2 classes, it should be one class or a hierarchy.

  • 0

Ah, the Seperate Interface pattern, never thought of that.

  Quote
You should really rethink your design, though. If that much data and functionality really needs to be shared between 2 classes, it should be one class or a hierarchy
Yeah, thats what I meant when I said
  Quote
If the libraries will both be dependant on each other, would it not be easier to just compile them into the same project?

Also,

  Quote
I would love to put them in the same project but VS 2005 doesn't allow you to add a .dll file project into an existing Windows Form project

When you click File..Open or File..New, the dialog gives you the option of either creating a new solution, OR, adding the project to the existing solution.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Thunderbird 139.0.2 by Razvan Serea Thunderbird is a free, open-source, cross-platform application for managing email and news feeds. It is a local (rather than a web-based) email application that is powerful yet easy-to-use. Thunderbird is clean and elegant by default, but easily customizable to match your workflow and visual preferences. It is loaded with unique and powerful features. Thunderbird is developed, tested, translated and supported by the folks at Mozilla Corporation and by a group of dedicated volunteers. Thunderbird gives you control and ownership over your email. There are lots of add-ons available for Thunderbird that enable you to extend and customize your email experience. Thunderbird gives you IMAP/POP support, a built-in RSS reader, support for HTML mail, powerful quick search, saved search folders, advanced message filtering, message grouping, labels, return receipts, smart address book LDAP address completion, import tools, and the ability to manage multiple e-mail and newsgroup accounts. Thunderbird 139.0.2 fixes: Security fixes Download: Thunderbird 139.0.2 for Windows (EN/US) | 32-bit | ~70.0 MB (Open Source) Download: Thunderbird 139.0.2 for Linux (EN/US) | 74.7 MB Download: Thunderbird 139.0.2 for Mac OS (EN/US) | 127.0 MB Download: Thunderbird 139.0.2 in other languages View: Thunderbird Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Thanks Nik and thanks Mind. Nik: Just on the off chance, you don't know where I could get this part at cheaper than normal price do you? I tried I few places but the I can find it at is 70GBP? Just gonna have to suck it up and buy the add-on for my PC. Thank you guys.
    • Underwhelming update. Same as 12,13,14,15. Then M3E ain't showing up until Q3
    • Smart Launcher seems a better option right now.
    • Mistral AI's new 'Magistral' models bring traceable, faster AI reasoning by Paul Hill One of Europe’s leading AI companies, Mistral, has announced the availability of its Magistral reasoning model. It comes in two versions: there is the open-source Magistral Small (24B parameters) and the enterprise-focused Magistral Medium. Magistral has been designed to better handle domain-specific tasks such as law, finance, and engineering. It shows users the model’s thought processes so that it’s more transparent, and it supports multilingual reasoning to perform better when tasked with answering non-English queries. Key features and performance Mistral compared its new models against DeepSeek R1 in various benchmarks. Ones that stood out were its results on AIME2024, which assesses reasoning capabilities. Magistral Medium scored 73.6% (90% with majority voting @64) while Small scored 70.7% (83.3% respectively). If you’ve used DeepSeek R1, you’ll have seen it thinking before answering. Magistral now does this too and can do it across multiple languages, including English, French, Spanish, German, Italian, Arabic, Russian, and Simplified Chinese. Interestingly, there’s also a Flash Answers mode that speeds up the thinking for 10x faster responses compared to competitors. Real-world applications and availability Thanks to the expertise Magistral has been trained on, organizations across multiple fields, including legal research, financial forecasting, and regulated industries, may be able to turn to Magistral for more reliable answers. Its traceable reasoning also makes it ideal in regulated fields for compliance and auditability. Magistral Small, the open-source model, is available under an Apache 2.0 license via Hugging Face. Magistral Medium is accessible through Mistral's Le Chat and via API on La Plateforme. It’ll also be arriving soon on Amazon SageMaker, IBM WatsonX, Azure AI, and Google Cloud Marketplace. The easiest way for readers to try it out is on Mistral's Le Chat platform; just head to chat.mistral.ai to get started. Source: Mistral
  • Recent Achievements

    • Week One Done
      elsa777 earned a badge
      Week One Done
    • One Month Later
      elsa777 earned a badge
      One Month Later
    • First Post
      K Dorman earned a badge
      First Post
    • Reacting Well
      rshit earned a badge
      Reacting Well
    • Reacting Well
      Alan- earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      544
    2. 2
      ATLien_0
      272
    3. 3
      +FloatingFatMan
      207
    4. 4
      +Edouard
      201
    5. 5
      snowy owl
      139
  • Tell a friend

    Love Neowin? Tell a friend!