我将我的ASP.net MVC程序中的对象序列化为xml字符串,如下所示;如何在c#中序列化对象时设置xmlns
StringWriter sw = new StringWriter();
XmlSerializer s = new XmlSerializer(typeof(mytype));
s.Serialize(sw, myData);
现在,这给了我作为前2行;
<?xml version="1.0" encoding="utf-16"?>
<GetCustomerName xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
我的问题是, 我如何可以改变的xmlns和编码类型,序列化的时候?
感谢