Category Archives: DataContractSerializer

WCF errors: Type ‘xxx’ is an invalid collection type since it has DataContractAttribute attribute.

If you have ever happen to get “Type xxx is an invalid collection type since it has DataContract Attribute attribute” error at any time when ever publishing WCF service, Make sure you annotate your custom collections with CollectionDataContract attribute instead of DataContract attribute. This attribute will appropriate serialize and deserialize collection.CollectionDataContract attribute is typically utilized… Read More »

Windows Commuication Foundation(WCF) Data Contract serialization techniques

WCF 3.5 supports two types of serialization techniques. DataContractSerializer XmlSerializer DataContractSerializer Vs XMLSerializer In contrast to predecessor XmlSerializer, DataContractSerializer serializes only members declared explicitly using DataMember attribute. XmlSerializer serializes all members of data contract except for members declared explicitly using NotSerialized attribute. WCF Serialization Caveats: .Net Built-in collection types and custom collections implementing IEnumerable or… Read More »