2

Can we use Reflection to read COM object properties info?

I am trying to get Property Name and Value of a COM object using the below code.

But it fails.

here connection is my COM object.

foreach (PropertyInfo info in connection.GetType().GetProperties())
        {

        MyProperty property = new MyProperty();
        property.Name = info.Name;
        property.Value = info.GetValue(connection, null);
    }

Can anyone help me out?

sqlnewbie
  • 857
  • 3
  • 16
  • 39

0 Answers0