本文整理汇总了C#中SrmDocument.RemoveAllBut方法的典型用法代码示例。如果您正苦于以下问题:C# SrmDocument.RemoveAllBut方法的具体用法?C# SrmDocument.RemoveAllBut怎么用?C# SrmDocument.RemoveAllBut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SrmDocument
的用法示例。
在下文中一共展示了SrmDocument.RemoveAllBut方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyPaste
private static SrmDocument CopyPaste(SrmDocument sourceDoc, IEnumerable<DocNode> nodes, SrmDocument targetDoc, IdentityPath to)
{
SetDefaultModifications(targetDoc);
if(nodes != null)
sourceDoc = sourceDoc.RemoveAllBut(nodes);
var stringWriter = new XmlStringWriter();
using (var writer = new XmlTextWriter(stringWriter) { Formatting = Formatting.Indented })
{
XmlSerializer ser = new XmlSerializer(typeof(SrmDocument));
ser.Serialize(writer, sourceDoc);
}
IdentityPath newPath, nextAdd;
targetDoc = targetDoc.ImportDocumentXml(new StringReader(stringWriter.ToString()),
null,
MeasuredResults.MergeAction.remove,
false,
null,
Settings.Default.StaticModList,
Settings.Default.HeavyModList,
to,
out newPath,
out nextAdd,
false);
return targetDoc;
}