I am not familiar with this library, but I can give some suggestions. When you look at a problem from a COM perspective, you will see that there is no simple answer.
(Keep in mind that in COM all objects are just objects, and the only condition is that it must support IUNKNOWN (and possibly other interfaces). Thus, the answer to the question "what type of object is it", often may have more than one answer.)
It is important to remember that in COM the list of interfaces for an object is not defined in any metadata, as in .NET (except that the library usually provides an additional type library as a form of documentation for development tools - more on that in a minute).
The list of interfaces is officially determined only by the results of calling the IUNKNOWN QueryInterface () method, that is, it is completely determined by the result of the code execution.
Several times the list can be hard-coded. Often the list may not be known until runtime, and it may not even be known until someone asks . The only rule is that the list of interfaces must be stable and what I call reasonable: the list cannot change over time for a given instance of the object; he must support IUNKNOWN, which is sometimes forgotten by people; if it supports a derived interface, it must support its base; and a couple of others, I'm sure I forget.
This last point is crucial for your problem: COM does not know a priori which interfaces are supported by any object. .NET runtime knows neither one nor the other. The only way for .NET to know would be if the type library for the object says that the returned object has a specific interface. If this is not the case, all you have is an IUNKNOWN pointer, and you need to set specific interfaces through code and see if you have a non-NULL answer.
Since the type of the SelectedItem property is an object, this means that the type library simply says: "The return type is an interface pointer of type IUNKNOWN" (this may be IDISPATCH, but the principle is worth it). The exact type obviously depends on the execution conditions - βwhat will be chosen right nowβ.
(In .NET, the return type is actually System.__ComObject , because you are not getting a bare pointer to the interface, but a COM calling shell on which the .NET proxy is based on an object)
You are at the mercy of the documentation of the (poor?) Library to get an idea of ββwhat types of interfaces the returned object can support. The disadvantage of this code, for example, Chibacity, can lead to you a partial list (I have not looked at this code yet). Ultimately, you probably want to use this code to get a list of candidate interfaces during debugging.
Once you find out a few features that interest you, you can save on some typing problems by simply using the C # as operator (which forces the COM calling shell to issue appropriate COM spells against its own object).