C# creating XML output file without <?xml version=“1.0” encoding=“utf-8”?>

后端 未结 2 1908
既然无缘
既然无缘 2021-01-04 10:51

I\'m new to C# development so maybe a very simple question here.

I\'m trying to get an output which starts as this:

    

        
2条回答
  •  梦毁少年i
    2021-01-04 11:19

     private string RemoveXmlDefinition(string xml)
     {
        XDocument xdoc = XDocument.Parse(xml);
        xdoc.Declaration = null;
    
        return xdoc.ToString();
     }
    

提交回复
热议问题