R
Robert Rotstein
If I have accessed a COM object in this manner:
Type MyType = Type.GetTypeFromProgID("someCOMobject");
Object ThisObj = Activator.CreateInstance(MyType);
object returnedItems = MyType.InvokeMember("someFunction",
System.Reflection.BindingFlags.InvokeMethod, null, ThisObj, null);
and I happen to know that returnedItems is a
Microsoft.VisualBasic.Collection object, then what is the correct way to
access the individual items in that collection? Doing
foreach (object item in (Collection) returnedItems)
causes an System.InvalidCastException exception.
Type MyType = Type.GetTypeFromProgID("someCOMobject");
Object ThisObj = Activator.CreateInstance(MyType);
object returnedItems = MyType.InvokeMember("someFunction",
System.Reflection.BindingFlags.InvokeMethod, null, ThisObj, null);
and I happen to know that returnedItems is a
Microsoft.VisualBasic.Collection object, then what is the correct way to
access the individual items in that collection? Doing
foreach (object item in (Collection) returnedItems)
causes an System.InvalidCastException exception.