Node.Range property

Returns a Range object that represents the portion of a document that is contained in this node.

public Range Range { get; }


Shows how to delete all the nodes from a range.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Add text to the first section in the document, and then add another section.
builder.Write("Section 1. ");
builder.Write("Section 2.");

Assert.AreEqual("Section 1. \fSection 2.", doc.GetText().Trim());

// Remove the first section entirely by removing all the nodes
// within its range, including the section itself.

Assert.AreEqual(1, doc.Sections.Count);
Assert.AreEqual("Section 2.", doc.GetText().Trim());

See Also