Ignacio,
Thanks for replying!
It's a little more complicated than my first explanation, but here is
an attempt at a 'better' one.
Class A is a server class that contains class B (a TCP server class),
which in turn contains class C (a TCP client handler class) that is
launched in a separate thread when a connection is made.
Class B is also sat on a different thread to class A.
Class E runs on it's own thread, and is responsible for processing
objects of type Class D that are put into it's queue by class C.
Funnily enough, i have actually already done what you suggested, and as
i add items to the queue using lock(Queue) i assume it will be thread
safe...
Cheers,
James.
Ignacio Machin ( .NET/ C# MVP ) wrote:
> Hi ,
>
> You will have to pass a reference of E to B which will pass it over to C.
>
> Can you give a little more detail about the creation time of all the
> instances?
>
>
> --
> --
> Ignacio Machin,
> ignacio.machin AT dot.state.fl.us
> Florida Department Of Transportation
>
> "pigeonrandle" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> > Funnily enough, i have a question about passing data between classes.
> > There's an excellent diagram below to help drive away any confusion.
> >
> > I have class A which contains an instance of class B and class E.
> > Class B contains an instance of class C.
> >
> > What is the best way to move an object (class D) created in class C to
> > class E?!
> >
> > A
> > {
> > ..B
> > {
> > ....C
> > {
> > ......D (from inside class C)
> > }
> > }
> > ..E
> > {
> > .... (to inside class E)
> > }
> > }
> >
> > I am currently raising a chain of events in the classes with class D as
> > part of the EventArgs. This seems like a rather contrived method so any
> > adivice you have will be greatfully received.
> >
> > Cheers,
> > James Randle.
> >
|