0
在我的應用程序中,我試圖從我的WPF應用程序調用ATL COM類的函數。 ATL COM類的函數參數是這樣的。將double [,]轉換爲Variant *
[id(5)] HRESULT GetFormationZPoints([in] BSTR sLyrName, [in,out] VARIANT* pLandingPoints);
而在WPF的一面,我想傳遞一個雙重的2-d陣列這樣
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);
我收到以下錯誤消息。 「參數2:無法從'參考雙[,]'轉換爲'參考對象'
任何人都可以請幫忙。 非常感謝提前。
我試過這個,但是這不能編譯。給出錯誤消息「ref或out參數必須是可賦值的值」。所以我試過這個 object obj =(object)dLPs; gaInfo.GetFormationZPoints(targetReservoir.TargetLayerName,ref obj); 所以這個工作很棒。非常感謝幫助隊友:) – WAQ