2010-05-11 67 views
0
[WebMethod] 
    public List<DictionaryClass<string,string>> GetDataByModuleDictionary(string ModuleName) 
    { 

     return BAL_GeneralService.GetDataByModuleDictionary(ModuleName); 
    } 

here i m getting the following error... 

    The type DictionaryClass`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] is not supported because it implements IDictionary. 

回答

0

XMLSerializer無法序列化一個實現IDictionary的類。要解決這個問題,你需要在你的DictionaryClass中實現System.Xml.Serialization.IXmlSerializable。有關更多信息,請參見here

+0

我可以將IDiction轉換爲任何其他類型並返回該對象... – girish 2010-05-11 09:30:51

+0

是的,你可以將它轉換爲數據表並返回一個數據表列表。這可能與實現IXmlSerializable大致相同。您也可以嘗試使用LINQ將其轉換爲其他內容,但我無法想象您可能會將其轉換爲。 – 2010-05-11 11:50:00

相關問題