-1

I want to pass information from one project to another with delegates. The project is with Sockets and I wanted that an event is triggered when either the client project or the server project send a data so that the information can appear in their respective information forms. But I have tried to make reference between these projects and he tells me that you can't because there can be a circular dependency.

How can I share the same event in two projects and make changes in the opposite form?

calvin11
  • 187
  • 1
  • 17
  • sounds like they will both need to ref a shared project to me... – jazb Nov 20 '18 at 00:57
  • @JohnB Yes, these projects are inherited from the same project. Do you have any idea how to make an event managed between the two of you? – calvin11 Nov 20 '18 at 00:59
  • 1
    no when i said `project` i meant a class library - ie a visual-studio-project – jazb Nov 20 '18 at 01:01
  • @JohnB Ah ok. And do you know of a tutorial to make such a library and use an event? Because I'm new in C# and event programming and I'm a bit lost – calvin11 Nov 20 '18 at 01:03
  • 1
    https://www.c-sharpcorner.com/uploadfile/61b832/creating-class-library-in-visual-C-Sharp/ – TheGeneral Nov 20 '18 at 01:04

1 Answers1

2

You will need to change your structure

Projects

Shared class library
   Shared stuff

project 1
   reference -> Shared class library

project 2
   reference -> Shared class library
TheGeneral
  • 79,002
  • 9
  • 103
  • 141