K
Kyjan
Greetings to all!
I have a question about events vs. timers. I want to know what you
guys think and/or have experienced. Thank you in advance for reading
this!
I have an object that communicates back and forth with a web service.
Now, this object is currently instantiated in all forms where I need
to communicate with the web service. This works fine; however, I can
have an instance where multiple requests are going off at the same
time, even from the same form (I have user controls that
asynchronously communicate as well).
I want to create a "collection" type of class that manages how many
requests are being made at a given time (no more than a set limit).
The class would hold a collection of these web communicators.
My question is this. Performance wise (and any other considerations I
may not be thinking about), would it be better to have a method on the
collection class that raises an event in the communicator object,
telling it to communicate, or would it be better to have a timer
running in the collection class that every so often (500-1000ms), it
checks the queue to see if there are any pending communication
requests and fires them off.
Thoughts?
Thanks!
Kyjan
I have a question about events vs. timers. I want to know what you
guys think and/or have experienced. Thank you in advance for reading
this!
I have an object that communicates back and forth with a web service.
Now, this object is currently instantiated in all forms where I need
to communicate with the web service. This works fine; however, I can
have an instance where multiple requests are going off at the same
time, even from the same form (I have user controls that
asynchronously communicate as well).
I want to create a "collection" type of class that manages how many
requests are being made at a given time (no more than a set limit).
The class would hold a collection of these web communicators.
My question is this. Performance wise (and any other considerations I
may not be thinking about), would it be better to have a method on the
collection class that raises an event in the communicator object,
telling it to communicate, or would it be better to have a timer
running in the collection class that every so often (500-1000ms), it
checks the queue to see if there are any pending communication
requests and fires them off.
Thoughts?
Thanks!
Kyjan