我已经使用 vb 编写了 WCF 服务。由第三方用 c# 编写的客户端需要两个输出参数。
该服务工作正常,但输出参数有问题。
搜索所以我找到了解决方案,我已经能够使用前缀声明这两个参数。
一个参数是一个字符串,另一个是一个对象数组,如下面的声明所示。
Function getStatusAndCosts(<Out()> ByRef commStatus() As communicationStatus, <Out()> ByRef communicationError As String, ByVal strUser As String, ByVal strPwd As String, ByVal communicationId As Guid) As Boolean
当我启动客户端时,数组返回空,而字符串填充了正确的数据。
Dim bTest As Boolean = False
Dim strTest As String ="-"
Dim tmpcommListArray() As DocPos_WebService.IDocPoscommunicationStatus
Dim tmpGuid As New Guid("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
bTest = client.getStatusAndCosts(tmpcommListArray, strTest, "yyy", "yyy", tmpGuid)
我试图删除第二个输出参数(参见下面的声明)
Function getStatusAndCosts(<Out()> ByRef commStatus() As communicationStatus, ByVal strUser As String, ByVal strPwd As String, ByVal communicationId As Guid) As Boolean
在这种情况下,数组中填充了正确的数据。
我还尝试更改参数的顺序但没有结果(字符串已填充数组返回空)
我哪里错了?vb中是否可以有多个输出参数?
感谢您的回复!