“Any public static members of XmlDocument are thread safe. Any instance members are not guaranteed to be thread safe” : yes, but
问题 I see in the XmlDocument class documentation on MSDN that Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe. Same thing for the XmlNodeList class. I am using those classes in the following context. Inside a Parallel.Foreach I do : X MyX = new X(); string XMLstring = MyX.GetXML(ID, true); XmlDocument doc = new XmlDocument(); doc.LoadXml(XMLstring); XmlNodeList nodeList = doc.SelectNodes("blah/secondblah")