tomas

tomas

  • NA
  • 7
  • 0

Event Firing

Jun 11 2007 2:12 PM
Hello, I hope one of you have found a solution to the following problem before. . . Thanks in advance if you have. I'm receiving events from an external dll (an RTDServer - set up like an observer pattern), and i've a Notify method that's called when there's an update to be collected. I can then collect a System.Array with a list of updates on a separate thread. The problem is that the list will contain a number of different update types, and i've to set different variables in an object based on the differentupdates andI've to handle that list (one by one). Which of the following are possible/advisable, and can anyone recommend a better approach? (a) use a hashtable/sortedlist/sorteddictionary with an indexer and the names of some variables in an object. Search the list, set the object variable, and let the object call any other events needed in the get/set method. (b) write some kind of custom enumerator for the event types or variables to be set. (c) use a hashtable/sortedlist/sorteddictionary with an indexer an objects of type Event. Just search the list for the indexer, and call the event to subscribers. (d) some combination of the above. The only thing is that speed is very important, because I migt have to call these events sequentially - I haven't investigated doing a foreach on the invocation list and calling asynchronously.Although they're small, I'll have possibly a hundred of these objects, with a hundred threads collecting updates. Any help with this problem would be much appreciated. Thanks, Tom.