简体   繁体   English

ObservableDictionary类 <TKey, TValue> :IDictionary <TKey, TValue> 作为DataContract

[英]class ObservableDictionary<TKey, TValue> : IDictionary<TKey, TValue> as DataContract

How to decorate 如何装修

public class ObservableDictionary<TKey, TValue> : IDictionary<TKey, TValue>, INotifyCollectionChanged, INotifyPropertyChanged

as DataContract (or something like this) in WCF service? 作为WCF服务中的DataContract (或类似的东西)?

据我所记得,如果您的ObservableDictionary<TKey, TValue>类是可序列化的,则自WCF 3.5 SP1起,无需将其标记为DataContract (请参阅问题: WCF datacontract vs class serialize )。

You need CollectionDataContractAttribute 您需要CollectionDataContractAttribute

The CollectionDataContractAttribute is also intended to be used with dictionary types to handle keyed collections. CollectionDataContractAttribute也旨在与字典类型一起使用以处理键集合。 Dictionary types are classes that implement either the IDictionary or the IDictionary interface, for example, the Dictionary. 字典类型是实现IDictionary或IDictionary接口的类,例如Dictionary。

Take a look for more details CollectionDataContractAttribute Class 查看更多详细信息CollectionDataContractAttribute类

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何转换IDictionary <TKey, List<TValue> &gt;到IDictionary <TKey, IEnumerable<TValue> &gt;? - How to convert IDictionary<TKey, List<TValue> > to IDictionary<TKey, IEnumerable<TValue> >? 为什么IDictionary <TKey,TValue>扩展ICollection <KeyValuePair <TKey,TValue >>? - Why does IDictionary<TKey, TValue> extend ICollection<KeyValuePair<TKey, TValue>>? 推荐的转换IGrouping的方法 <TKey, TValue> 到IDictionary <TKey, IEnumerable<TValue> &gt; - Recommended way to convert IGrouping<TKey, TValue> to IDictionary<TKey, IEnumerable<TValue>> 无法序列化我的`ObservableDictionary <TKey,TValue> `班 - Can't serialize my `ObservableDictionary<TKey,TValue>` class 转换iDictionary <TKey,TValue> 进入IDictionary <TSomeProperty, ICollection<TValue> &gt; - Convert iDictionary<TKey,TValue> into IDictionary<TSomeProperty, ICollection<TValue>> IDictionary <TKey,TValue>替换值的实现和合同 - IDictionary<TKey, TValue> implementation and contract for replacing values 嵌套接口:演员表IDictionary <TKey, IList<TValue> &gt;到IDictionary <TKey, IEnumerable<TValue> &gt;? - Nested Interfaces: Cast IDictionary<TKey, IList<TValue>> to IDictionary<TKey, IEnumerable<TValue>>? ConcurrentDictionary <TKey,TValue> vs词典 <TKey,TValue> - ConcurrentDictionary<TKey,TValue> vs Dictionary<TKey,TValue> 为什么不能/不能IDictionary <TKey,TValue>实现ILookup <TKey,TValue>? - Why doesn't/couldn't IDictionary<TKey,TValue> implement ILookup<TKey,TValue>? 当方法具有IDictionary和IDictionary的重载时的不明确调用<TKey, TValue> - Ambiguous call when a method has overloads for IDictionary and IDictionary<TKey, TValue>
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM