In C#, is there a way to add an XML node to a file on disk WITHOUT loading it first?

前端 未结 8 1990
后悔当初
后悔当初 2020-12-20 14:14

I have a very basic XML structure/file on disk which is something like:


    kdkdkdk         


        
8条回答
  •  没有蜡笔的小新
    2020-12-20 14:41

    I can't see a way to do what you're up to without reading the full file, but as a workaround maybe you could treat the file as a plain text ie without the root node (it will be invalid XML). Then, you could just append new nodes to the file as plain text. And, since your XML parsing process loads the entire file anyway, it can add the root node before treating it as XML.

提交回复
热议问题