c# xml.Load() locking file on disk causing errors

前端 未结 4 1773
醉梦人生
醉梦人生 2020-12-05 23:46

I have a simple class XmlFileHelper as follows:

public class XmlFileHelper
{
    #region Private Members

    private XmlDocument xmlDoc = new XmlDocument();         


        
4条回答
  •  自闭症患者
    2020-12-06 00:40

    If the file isn't too big to read into memory all at once:

    xml.Load(new MemoryStream(File.ReadAllBytes(path)));
    

提交回复
热议问题