I've been looking at the VSTO libraries, mostly for the fun of it, and I noticed that there's something called Inspector as well as InspectorClass.
What's the difference, why is it there and how can I put it to use? (NB I'm not looking for an answer on how to code using those classes but rather what the rationale behind that certain architecture pattern is. Purely academical curiosity.)
InspectorClassis a coclass (concrete implementation) of theInspectorCOM interface (e.g. it is a COM object with metadata + code). AnInspectorcan be instantiated directly even though it exists purely as an interface definition (it actually instantiatesInspectorClassbehind the scenes).InspectorClasscan be instantiated since it represents a concrete class instance, although as VSTO added support for embedding interop types in .NET 4 - support for the*Classusage is no longer used and serves to exist more or less for backwards compatibility.All this to say is that you should now be using
Inspectorand notInspectorClasswhich can contain executable code. From MSDN blogs:From this statement, you can deduce that
InspectorClasscontains executable code, whileInspectordoes not - it is purely an interface (metadata). This means that embedding interop types does not allow support for the*Classimplementations.