Sag*_*gor 5 c# asp.net vb6 vba
我想将一个int列表从C#传递给一个用vb6编写的dll.在vb6中,函数的原型如下:
Public Function FamIdentify(agentList As Collection, strName As String, strIdentifyTemplate As String, strIP As String) As Boolean
Run Code Online (Sandbox Code Playgroud)
从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 ;
}
Run Code Online (Sandbox Code Playgroud)
对于这种编码,我面临这个错误
cannot convert from system.collections.generic.list to string to Vba.collections
Run Code Online (Sandbox Code Playgroud)
如何将列表从C#传递给vb6?请帮我 .
您需要创建Microsoft.VisualBasic.Collection、添加值List,然后才将其传递给函数。我认为,没有直接转换为Collection.
Microsoft.VisualBasic.Collection agentCollection= new Microsoft.VisualBasic.Collection();
agentList.ForEach(x=> agentCollection.Add(x));
Boolean flag = famApp.FamIdentify(ref agentCollection, ref name, SampleModel, REMOTE_ADDR);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1032 次 |
| 最近记录: |