views:

109

answers:

1

Let's say I want to catch a COM event:

The preliminary documentation says to do something as so:

ComAutomationEvent on_event = ComAutomationFactory.GetEvent(some_COM_obj, "SomeEvent");
on_event.EventRaised += OnEvent;

OnEvent sig is as follows:

private void  OnEvent(object sender, ComAutomationEventArgs e)

ComAutomationEventArgs contains a "Arguments" property, which is of type object[].

Now, how exactly am I supposed to know what actual type the arguments are suppose to be? Are they COM types which require the "dynamic" keyword, or are they something else?

+1  A: 

One way to find out what what "actual types are supposed to be" is to read the documentation of the COM object whose event you are consuming. That'll tell you what order and type each argument will have.

You can use the GetType method on each Object if you really have to however I can't see how anything in the arguments array is very useful to you if you don't know what the COM event signature is.

AnthonyWJones