【发布时间】:2012-02-01 17:57:23
【问题描述】:
几年前,我编写了一个 WCF 服务,它在 IIS 下的 Windows 2003 服务器上运行。我使用 VS 2008 和 .NET 3.5 编写了它。有问题的代码是这样的:
public static List<ASILookupTables> GetLookupTableAux(bool UseProduction)
{
ASIClassesDataContext dcASI = new ASIClassesDataContext();
var result = from lookups in dcASI.ASILookupTables4s
orderby lookups.SortOrder
select lookups;
List<ASILookupTables> list = new List<ASILookupTables>();
foreach (var item in result)
{
ASILookupTables alt = new ASILookupTables();
//more lines to add other elements
list.Add(alt);
}
return list;
}
现在我正在使用 .NET 4.0 编写一个 VS 2010 应用程序来使用它。 VS 2010 应用程序中有问题的代码 sn-p 是这样的:
LookupSvc.LookupsClient proxy = new LookupSvc.LookupsClient();
//retrieve list of lookup tables
List<LookupSvc.ASILookupTables> lookupTables = proxy.GetLookupTableAux(true);
但是,我收到以下错误:
“无法将类型 'AsiEF.LookupSvc.ASILookupTables[]' 隐式转换为 'System.Collections.Generic.List'”
我不明白;在 WCF 代码中,它看起来像我正在返回一个列表。看起来我不是在返回一个数组。是不是因为 WCF 服务在 .NET 3.5 中,而我的新项目在 .NET 4.0 中?
【问题讨论】:
标签: .net wcf visual-studio-2010 visual-studio-2008