public void CloneCompositeNode()
{
//ExStart
//ExFor:Node
//ExFor:Node.Clone
//ExSummary:Shows how to clone composite nodes with and without their child nodes.
// Create a new empty document.
Document doc = new Document();
// Add some text to the first paragraph
Paragraph para = doc.FirstSection.Body.FirstParagraph;
para.AppendChild(new Run(doc, "Some text"));
// Clone the paragraph and the child nodes.
Node cloneWithChildren = para.Clone(true);
// Only clone the paragraph and no child nodes.
Node cloneWithoutChildren = para.Clone(false);
//ExEnd
Assert.IsTrue(((CompositeNode)cloneWithChildren).HasChildNodes);
Assert.IsFalse(((CompositeNode)cloneWithoutChildren).HasChildNodes);
}