Remove “d1p1” namespace prefix in DataContractSerializer XML output

前端 未结 3 820
长情又很酷
长情又很酷 2021-01-04 04:22

I\'m using DatacontractSerializer to serialize my domainModel into a xml file. I\'m getting output like below.



        
3条回答
  •  失恋的感觉
    2021-01-04 04:58

    You should be able to get rid of those prefixes by just making sure that the classes that you are trying to serialize to XML are within the same Namespace. For example I had two classes ApplicationListResponse and Application. Previously the namespaces were Models.Responses and Models.Responses.Application. I changed both of the Namespaces to be "Models" and that got rid of the prefix in the XML output.

提交回复
热议问题