Serializing object with no namespaces using DataContractSerializer

前端 未结 2 1501
南笙
南笙 2020-12-08 10:11

How do I remove XML namespaces from an object\'s XML representation serialized using DataContractSerializer?

That object needs to be serialized to a very simple outp

2条回答
  •  星月不相逢
    2020-12-08 10:27

    You need to mark the classes you want to serialize with:

    [DataContract(Namespace="")]
    

    In that case, the data contract serializer will not use any namespace for your serialized objects.

    Marc

提交回复
热议问题