Click here to Skip to main content
15,921,697 members
Home / Discussions / C#
   

C#

 
QuestionIEnumerable and IEnumerator Pin
Alex Cutovoi23-Nov-05 15:32
Alex Cutovoi23-Nov-05 15:32 
QuestionIEnumerable and IEnumerator Pin
Alex Cutovoi23-Nov-05 15:31
Alex Cutovoi23-Nov-05 15:31 
Questionselect date into the textbox Pin
momoo23-Nov-05 13:53
momoo23-Nov-05 13:53 
AnswerRe: select date into the textbox Pin
Christian Graus23-Nov-05 14:37
protectorChristian Graus23-Nov-05 14:37 
Questionprocess.start Pin
Sam 200623-Nov-05 11:51
Sam 200623-Nov-05 11:51 
AnswerRe: process.start Pin
Curtis Schlak.23-Nov-05 12:03
Curtis Schlak.23-Nov-05 12:03 
QuestionDelegates and events Pin
mirano23-Nov-05 9:21
mirano23-Nov-05 9:21 
AnswerRe: Delegates and events Pin
Leslie Sanford23-Nov-05 11:46
Leslie Sanford23-Nov-05 11:46 
mirano wrote:
The problem is when trying to subscribe to the event from a class B that has no reference to class A.
It would be easy enough to add a reference to it and to just subscribe to the event, however we do not want to make the server code to reference the client classes.


You could make the event handler in Class B public and have a mediator class attach it to the event in Class A.

Or have an interface represent only the event that's in Class A that Class B needs to subscribe to. Hopefully, the event represents something easily identifiable so that it's easy to name.

Have Class A implement this interface. Pass an instance of Class A to Class B as a reference to the interface, not Class A. This way, Class B only knows about the interface. This decouples Class B from Class A.

mirano wrote:
If not, that what about adding an intermediary object that can receive and pass on the events raised in class A on the client side, so that class B on the server needs only to reference one object*


I would go the interface route first. The interface is in essence doing the job that your intermediary object is doing, only basically for free.



-- modified at 17:47 Wednesday 23rd November, 2005
GeneralRe: Delegates and events Pin
mirano23-Nov-05 13:00
mirano23-Nov-05 13:00 
GeneralRe: Delegates and events Pin
Leslie Sanford23-Nov-05 13:23
Leslie Sanford23-Nov-05 13:23 
GeneralRe: Delegates and events Pin
mirano26-Nov-05 6:19
mirano26-Nov-05 6:19 
GeneralRe: Delegates and events Pin
Leslie Sanford26-Nov-05 7:08
Leslie Sanford26-Nov-05 7:08 
GeneralRe: Delegates and events Pin
mirano27-Nov-05 9:07
mirano27-Nov-05 9:07 
QuestionSounds - what were they thinking - they forgot about sound!!!!! Pin
Giles23-Nov-05 9:03
Giles23-Nov-05 9:03 
AnswerRe: Sounds - what were they thinking - they forgot about sound!!!!! Pin
Leslie Sanford23-Nov-05 9:21
Leslie Sanford23-Nov-05 9:21 
GeneralRe: Sounds - what were they thinking - they forgot about sound!!!!! Pin
Giles23-Nov-05 9:48
Giles23-Nov-05 9:48 
GeneralRe: Sounds - what were they thinking - they forgot about sound!!!!! Pin
Leslie Sanford23-Nov-05 10:49
Leslie Sanford23-Nov-05 10:49 
GeneralRe: Sounds - what were they thinking - they forgot about sound!!!!! Pin
Giles23-Nov-05 11:43
Giles23-Nov-05 11:43 
QuestionPrinter driver Pin
hg270523-Nov-05 8:45
hg270523-Nov-05 8:45 
AnswerRe: Printer driver Pin
Giles23-Nov-05 9:08
Giles23-Nov-05 9:08 
Questionmoving the mouse Pin
Sam 200623-Nov-05 8:10
Sam 200623-Nov-05 8:10 
AnswerRe: moving the mouse Pin
User 665823-Nov-05 8:38
User 665823-Nov-05 8:38 
GeneralRe: moving the mouse Pin
Sam 200623-Nov-05 11:59
Sam 200623-Nov-05 11:59 
QuestionSource safe slow pulling files - NAnt Get Pin
glocklt423-Nov-05 7:11
glocklt423-Nov-05 7:11 
AnswerRe: Source safe slow pulling files - NAnt Get Pin
Daniel Turini23-Nov-05 7:44
Daniel Turini23-Nov-05 7:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.