I'm trying to use a old VB library in a C# application.
This library has a couple of classes, one in particular has a method returns an instance of itself example: Posts post = new Posts().GetLast();
The Posts class has a property Comments that is actually of type object. In VB I can iterate trough the Comments property like trough a Microsoft.VisualBasic.Collection
, but in C# I cannot cast the property, in order to use it, to anything. I tried importing the Microsoft.VisualBasic namespace, and typecasting to Collection, but it didn't work returning a error that said System.__ComObject has to be cast to a spcific Interface from the library.
Inside the collection there are objects that implement the interface IComments, I cannot cast to the interface because it is a collection of the interface.
I also tried casting to ICollection (the interface that is implemented by Microsoft.VisualBasic.Collection
) but with no positive result.
Any idea on how to solve this issue, my only way out of this problem is by changing the C# application to a VB one (not that difficult, but still a thing that i would prefer avoiding)