Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以轻松地从 xelement 创建新的 xdocument?我有一个大的 xml 文件,我想从中创建几个 xdocuments。
string xml = "<Root><Child1>aaa</Child1><Child2>bbb</Child2></Root>"; XDocument xDoc = XDocument.Parse(xml); var xDocs = xDoc.Root.Elements() .Select(e => new XDocument(e)) .ToList();
此示例创建两个包含 Child1 和 Child2 的 xDocument