Using System.Dynamic to Introspect COM Objects

How can I use IDynamicMetaObjectProvider to introspect COM objects? In particular, given an arbitrary COM object, I want to return a dictionary in which the key is the name of the property and Value is the string value of the property in the COM object (if the property value is not a string, skip it).

How can I get property names and their values ​​at runtime like this?

+4
source share
1 answer

You can not; objects are not required to implement IDynamicMetaObjectProvider to provide dynamic functionality; this is a hook that allows them to contribute to the binding process.

For this kind of operation, you still have to reset before using Reflection to get the elements and values.

+1
source

Source: https://habr.com/ru/post/1339278/


All Articles