In my application I'm trying to call a function of ATL COM class from my WPF application. ATL COM class's function's parameters are like this.
[id(5)] HRESULT GetFormationZPoints([in] BSTR sLyrName, [in,out] VARIANT* pLandingPoints);
And in WPF side, I am trying to pass a double's 2-D array like this
List<PointsVector> landingPoints = Planner.LandingPointsList;
double[,] dLPs = new double[landingPoints.Count, 3];
int i = 0;
foreach (PointsVector v in landingPoints)
{
dLPs[i, 0] = v.X;
dLPs[i, 1] = v.Y;
dLPs[i, 2] = v.Z;
i++;
}
gaInfo.GetFormationZPoints(targetReservoir.TargetLayerName, ref dLPs);
I get the following error message:
Argument 2: cannot convert from 'ref double[,]' to 'ref object
As mentioned in the exception , can you convert the dLPs variable to object and see whether it works . Basically it should look something like ,
gaInfo.GetFormationZPoints(targetReservoir.TargetLayerName, ref (object) dLPs);