使用服务中的ObservableCollection的System.Runtime.Serialization.InvalidDataContractException

编程入门 行业动态 更新时间:2024-10-22 05:12:29
本文介绍了使用服务中的ObservableCollection的System.Runtime.Serialization.InvalidDataContractException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Error =" System.Runtime.Serialization.InvalidDataContractException:类型'System.Collections.ObjectModel.ObservableCollection`1 [T]'无法导出为架构类型,因为它是开放的泛型类型。如果所有通用参数类型都是实际类型,则只能导出泛型类型。" 合同=

< ServiceContract()> P

Error="System.Runtime.Serialization.InvalidDataContractException: Type 'System.Collections.ObjectModel.ObservableCollection`1[T]' cannot be exported as a schema type because it is an open generic type. You can only export a generic type if all its generic parameter types are actual types."Contract=

<ServiceContract()>  P

ublic 接口 ITestServer < OperationContract()> < ServiceKnownType(GetType(ObservableCollection(Of)))> _

ublic Interface ITestServer<OperationContract()> <ServiceKnownType(GetType(ObservableCollection(Of )))> _

 

函数cGetSQLDataSources()As ObservableCollection(Of DarwinObjectModel.DarwinObjectModel.SQLDataSource) 另一个函数在接口返回数据集没有问题(如果我注释掉流氓函数)

结束

接口

Interface

 

推荐答案

这是一个自定义类吗? DarwinObjectModel.DarwinObjectModel.SQLDataSource类需要指定DataContract属性,并且所有暴露的属性都需要指定DataMember属性。 快乐编码! Is this a custom class?  The class DarwinObjectModel.DarwinObjectModel.SQLDataSource needs to specify DataContract attribute and all properties exposed need to specify DataMember attribute.Happy Coding!

更多推荐

使用服务中的ObservableCollection的System.Runtime.Serialization.InvalidDataContractExcep

本文发布于:2023-11-10 02:23:34,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:System   ObservableCollection   Runtime   InvalidDataContractException   Serialization

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!