Java调用C# DLL传参数问题 20
我用Java调用别人的C#写的DLL参数类型一直不匹配我的Java:int[]commandArray={2,3,4,5};ObjectobjResult=Dispatc...
我用Java调用别人的C#写的DLL参数类型一直不匹配
我的Java:
int[] commandArray = {2, 3, 4, 5};
Object objResult = Dispatch.call(dotnetCom,"DeviceWriteThenRead",commandArray).getVariant();
C# Dll函数是
public object DeviceWriteThenRead(object commandArray){
if (commandArray.GetType() != typeof(object[]))
{
throw new ArgumentException("Argument must be an array of integers");
}
object[] objArray = (object[]) commandArray;
.....
}
运行一直报错
Argument must be an array of integers
请问我java里面的commandArray 应该是什么类型? 展开
我的Java:
int[] commandArray = {2, 3, 4, 5};
Object objResult = Dispatch.call(dotnetCom,"DeviceWriteThenRead",commandArray).getVariant();
C# Dll函数是
public object DeviceWriteThenRead(object commandArray){
if (commandArray.GetType() != typeof(object[]))
{
throw new ArgumentException("Argument must be an array of integers");
}
object[] objArray = (object[]) commandArray;
.....
}
运行一直报错
Argument must be an array of integers
请问我java里面的commandArray 应该是什么类型? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询