I have spent whole day today trying to get ba.getMarketDepth() to work properly. From the help it says that the COM interface should be returning an Array of MarketDepthSelection, but it looks like it is not the case. It returns an Object.

When going into Object within debug I can see that it is in fact an Array of MarketDepthSelection inside the Object itself.

The problem is, I cannot seem to find a way to cast that Object into an MarketDepthSelection array.
I have tried the following, but all of them give InvalidCastException:
- Code: Select all
Object aa = ba.getMarketDepth();
//aa.GetType();
if (aa != null)
{
BettingAssistantCom.Application.MarketDepthSelection[] sections = Array.ConvertAll((BettingAssistantCom.Application.MarketDepthSelection[])aa, s => (MarketDepthSelection)s); // doesn't work
BettingAssistantCom.Application.MarketDepthSelection[] sections = (BettingAssistantCom.Application.MarketDepthSelection[])aa; // doesn't work
}
I bet there is a some simple solution that I am not aware off and couldn't find on google. I really hope so.
Thank you.