C++ 将双精度[,]转换为变量*

C++ 将双精度[,]转换为变量*,c++,wpf,com,mfc,atl,C++,Wpf,Com,Mfc,Atl,在我的应用程序中,我试图从WPF应用程序调用ATL COM类的函数。ATL COM类的函数参数如下所示 [id(5)] HRESULT GetFormationZPoints([in] BSTR sLyrName, [in,out] VARIANT* pLandingPoints); 在WPF方面,我试图传递一个双精度的二维数组,如下所示 List<PointsVector> landingPoints = Planner.LandingPointsList; double[,]

在我的应用程序中,我试图从WPF应用程序调用ATL COM类的函数。ATL COM类的函数参数如下所示

[id(5)] HRESULT GetFormationZPoints([in] BSTR sLyrName, [in,out] VARIANT* pLandingPoints);
在WPF方面,我试图传递一个双精度的二维数组,如下所示

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);
List landingPoints=Planner.landingPoints列表;
double[,]dLPs=新的double[landingPoints.Count,3];
int i=0;
foreach(着陆点中的点向量v)
{
dLPs[i,0]=v.X;
dLPs[i,1]=v.Y;
dLPs[i,2]=v.Z;
i++;
}
gaInfo.GetFormationZPoints(targetReservoir.TargetLayerName,参考DLP);
我收到以下错误消息:

参数2:无法从“ref double[,]”转换为“ref object”


如异常中所述,您能否将dLPs变量转换为object,并查看它是否工作。基本上它应该看起来像

    gaInfo.GetFormationZPoints(targetReservoir.TargetLayerName, ref (object) dLPs);

我尝试过这个,但它无法编译。给出错误消息“ref或out参数必须为可赋值”。所以我尝试了这个对象obj=(object)dLPs;gaInfo.GetFormationZPoints(targetReservoir.TargetLayerName,参考对象);所以这项工作很好。非常感谢你的帮助,伙计:)