C# : the close method of Xml.Load(file)

后端 未结 3 456
无人共我
无人共我 2021-01-12 10:40

I have written some code that loads an XML document using an XmlDocument object so as to count it\'s nodes. Here is the method:

XmlDocument xml         


        
3条回答
  •  广开言路
    2021-01-12 11:18

    There is no need to set your object to null. The GC should be able to indicate if the Document isn't being used any further on it's own. This will happen automatically as memory is needed but if you want to clear it immediately call GC.Collect(). See this thread for further discussion.

提交回复
热议问题