0

I am using DataContract to save my own tasks. I cannot find if it is possible to declare a namespace in the header of the file. I do it with openxml document, but I could not figure it out with datacontract.

I think it makjes the XML file heavier, and at least harder to read. I have th efollowing declaration a dozen time per file.

xmlns:b="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>

Thank you

Yoyo
  • 101
  • 1
  • 11
  • Are you writing the actual serialization code (e.g. creating the `DataContractSerializer`)? There's a `NamespaceHandling` property lurking in the `XmlWriterSettings` class but obviously if some library/framework function is doing the actual serialization you may not be able to touch that (and it may not do *enough* with your particular blob of XML. Out of interest, why do you care about how *readable* the XML is? – Damien_The_Unbeliever Jul 31 '18 at 10:47
  • I use DataContractSerializer(typeof(T)) where T has datacontract attribute. I thought I would maybe save some marginal space. – Yoyo Jul 31 '18 at 12:09

0 Answers0