Write XML in Base64 encoding

前端 未结 4 2020
后悔当初
后悔当初 2021-01-20 00:37

Following my questions about storing data, it has been suggested that I could use XML but then obfuscate the file by encoding it using Base64. I like this idea, and I have a

4条回答
  •  隐瞒了意图╮
    2021-01-20 00:58

    You need to convert your xmlwriter to string like this

     using (var sw = new StringWriter()) {
     using (var xw = XmlWriter.Create(sw)) {
    // Build Xml with xw.
    
    
       }
      return sw.ToString();
    }
    

    then convert your string to Base64. and write it to file

提交回复
热议问题