Colin,
To the best of my knowledge, events are handled on the same thread they have
been raised on. So, in a single-threaded application, events are handled
just in the same order they have been raised - since raising an event
actually leads to calling one or more delegates (i.e. callbacks) subscribed
to this event.
For multi-threaded applications, I suppose, the order is retained for each
of the threads.
So, in your example:
1. Debug.WriteLine("step 1")
2. B.Setsomething=4 'this raises event A in class B
3. Debug.WriteLine("step2")
You should always be getting the same output:
step1
eventA handler for class B
step2
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"Colin McGuire" <co***********@lycos.co.uk> wrote in message
news:ab**************************@posting.google.c om... If I have a routine that handles event A of class B coded in VB.Net
like:
Private Sub handleEventA Handles B.eventA
Debug.WriteLine("eventA handler for class B")
End sub
and then I perform the following three steps
1. Debug.WriteLine("step 1")
2. B.Setsomething=4 'this raises event A in class B
3. Debug.WriteLine("step2")
The output window in my IDE would show the following:
step1
eventA handler for class B
step2
My question is is this guaranteed, is this how the event model works,
or put anotherway, are the events guaranteed to be raised
synchronously?
Thank you
Colin