【发布时间】:2009-03-04 12:31:47
【问题描述】:
我的应用程序中有一个描述专用列表的界面...
Public Interface IAlphabeticListItem
Property StartingLetter() As String
Property DetailsList() As Generic.List(Of DetailsData)
End Interface
多个对象实现此接口,但我想在 Web 服务中返回它们,而不是作为底层对象,而是作为接口。
<WebMethod()> _
Public Function GetCategoryList(...) As Generic.List(Of IAlphabeticListItem)
...
End Function
很遗憾,这会导致异常
无法序列化接口 IAlphabeticListItem。
异常详细信息:System.NotSupportedException:无法序列化接口 IAlphabeticListItem。
有没有办法使接口可序列化,还是我必须将我的每个对象转换为实现接口的具体类,然后返回该类?
【问题讨论】:
标签: vb.net web-services interface asmx