【发布时间】:2013-04-05 02:01:20
【问题描述】:
我想在 Web 服务中返回 List<string>[] 并以如下窗口形式使用该返回:
[WebMethod]
public List<string>[] MyMethod()
{
...
...
List<string>[] list_ar = new List<string>[]{list_optgroup, list_option, list_optgroup_option};
return list_ar;
}
但在 windows 窗体方面,我应该得到这样的返回值:
MyService_Soft service = new MyService_Soft();
string[][] str_ar = service.MyMethod();
发生了什么事,我怎样才能在 Windows 窗体一侧获得 List<string>[]?
另外,我似乎在这些行中有错误:
MyService_Soft service = new MyService_Soft();
string[][] str_ar = service.FillComboBoxes();
错误:
无法自动进入服务器。连接到服务器 机器 'blablabla' 失败。未知的用户名或错误的密码...
此错误是什么意思,我如何确定该 Web 服务中的哪一行导致了此错误?
【问题讨论】:
-
这个错误与列表有什么关系?看起来像是身份验证问题。
-
没有像
List<string>[]这样的东西。你要么想要像strings[]这样的数组,要么想要像List<string>这样的列表。 -
是否 string[][] str_ar = service.MyMethod();为你编译? MyMethod 返回一个列表数组而不是字符串数组
-
没有什么像 List
[] -> 那么我怎样才能在那个方法上返回 3 List 呢? -
Romoku你的意思不是这样吗..var someListArray = new List<string>[]{ new List<string>{ "Hello World" } };你的例子是不正确的语法
标签: c# winforms web-services return