【发布时间】:2015-05-14 11:37:34
【问题描述】:
我正在尝试通过 WCF 返回字典
public Dictionary<LanguageList> GetLanguageSettingList()
{
Repository exrepo = new Repository(this.ConnectionString);
return exrepo.GetLanguageSettingList();
}
public partial class LanguageList
{
public string Language { get; set; }
public Nullable<int> Id { get; set; }
}
错误为Error 1 Using the generic type 'System.Collections.Generic.Dictionary<TKey,TValue>' requires 2 type arguments c:\users\xxxxx\documents\visual studio 2013\projects\service\service\service.svc.cs 74 16 SaService
。我不确定我还需要传递什么才能返回字典有什么帮助吗?谢谢M
【问题讨论】:
-
字典有两个类型参数而不是一个。另外,LanguageList 类型是否可序列化?
-
LanguageList 只是作为存储过程中的列表返回,但我的应用程序需要它作为字典
-
我一直在读这篇文章,但运气不好stackoverflow.com/questions/1510185/…