【发布时间】:2017-10-25 21:44:07
【问题描述】:
我想将一个 int 列表从 C# 传递给一个用 vb6 编写的 dll。在vb6中函数原型如下:
Public Function FamIdentify(agentList As Collection, strName As String, strIdentifyTemplate As String, strIP As String) As Boolean
从C#我调用这个函数如下:
public Boolean IdentifyFinger(String name, String SampleModel, String REMOTE_ADDR)
{
List<int> agentList = new List<int>();
// insert some element to this list
FamServer.FamApp famApp = new FamServer.FamApp();
Boolean flag = famApp.FamIdentify(ref agentList, ref name, SampleModel, REMOTE_ADDR);
return flag ;
}
对于这个编码,我遇到了这个错误
cannot convert from system.collections.generic.list to string to Vba.collections
如何将列表从 C# 传递到 vb6 ?请帮我 。
【问题讨论】:
-
尝试转换为
System.Collections.ArrayList- 这种类型可以通过CreateObject()方法暴露给VBA。 -
你的评论我不清楚。你能解释一下吗?
-
在 C# 中创建一个
ArrayList,用List中的值填充它,在 VBA 代码中创建一个ArrayList,将ArrayList传递给 VBA... -
或为什么不直接使用
.toArray()方法并作为数组传递呢? -
我将使用数组的概念。只是尝试使用列表。如果我无法使用 list 执行此操作,那么我将使用 array 。