将双精度[,]转换为变量*
Convert double[,] to Variant*
在我的应用程序中,我试图从我的WPF应用程序调用atlcom类的函数。atlcom类函数的参数如下:
[id(5)] HRESULT GetFormationZPoints([in] BSTR sLyrName, [in,out] VARIANT* pLandingPoints);
在WPF方面,我试图传递一个double的二维数组,像这样
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 double[,]'转换为'ref object
如异常中所述,您可以将dlp变量转换为对象并查看它是否有效。基本上应该是这样的
gaInfo.GetFormationZPoints(targetReservoir.TargetLayerName, ref (object) dLPs);
相关文章:
- 如何在保持其值的同时将 c++ 无符号字符变量转换为 char 变量
- 是否可以将已经初始化的变量转换为 void*?
- C++字符串类如何将一个变量转换为另一个变量?
- std::chrono::time_point 从变量转换时编译器错误
- std::变量转换构造函数行为
- 尝试将字符串变量转换为布尔值会导致 "true" 和 "false" 都等于 0
- C++将字符变量转换为字符串变量将返回 ASCII 值
- 将大端序的 32 位变量转换为小端序
- 在代码优化过程中,C++11编译器是否会在可能的情况下将局部变量转换为右值
- 有符号浮点变量转换为无符号DWORD
- 将初始变量转换为已声明的变量
- 将C++字符串变量转换为long
- 如何将DWORD或char*类型的变量转换为LPCWSTR
- 如何在 c++ 中将包含时间的字符串变量转换为time_t类型
- C++变量转换为模板参数
- 将 [char] 变量转换为 [int],然后再转换回 [char]
- 如何将 int 变量转换为 ASCII 单词
- 将c++类的私有变量转换为公有变量
- 将变量转换为const
- 如何将方法返回的接口变量转换为对象